comparison src/video/SDL_video.c @ 5147:a1345acf7b3d

The renderers always support texture modulation and blend modes.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 01 Feb 2011 12:54:27 -0800
parents 31e7f523ab3d
children ad50b3db78bd
comparison
equal deleted inserted replaced
5146:b52793134276 5147:a1345acf7b3d
2060 SDL_Renderer *renderer; 2060 SDL_Renderer *renderer;
2061 2061
2062 CHECK_TEXTURE_MAGIC(texture, -1); 2062 CHECK_TEXTURE_MAGIC(texture, -1);
2063 2063
2064 renderer = texture->renderer; 2064 renderer = texture->renderer;
2065 if (!renderer->SetTextureColorMod) {
2066 SDL_Unsupported();
2067 return -1;
2068 }
2069 if (r < 255 || g < 255 || b < 255) { 2065 if (r < 255 || g < 255 || b < 255) {
2070 texture->modMode |= SDL_TEXTUREMODULATE_COLOR; 2066 texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
2071 } else { 2067 } else {
2072 texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR; 2068 texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR;
2073 } 2069 }
2108 SDL_Renderer *renderer; 2104 SDL_Renderer *renderer;
2109 2105
2110 CHECK_TEXTURE_MAGIC(texture, -1); 2106 CHECK_TEXTURE_MAGIC(texture, -1);
2111 2107
2112 renderer = texture->renderer; 2108 renderer = texture->renderer;
2113 if (!renderer->SetTextureAlphaMod) {
2114 SDL_Unsupported();
2115 return -1;
2116 }
2117 if (alpha < 255) { 2109 if (alpha < 255) {
2118 texture->modMode |= SDL_TEXTUREMODULATE_ALPHA; 2110 texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
2119 } else { 2111 } else {
2120 texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA; 2112 texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
2121 } 2113 }
2144 SDL_Renderer *renderer; 2136 SDL_Renderer *renderer;
2145 2137
2146 CHECK_TEXTURE_MAGIC(texture, -1); 2138 CHECK_TEXTURE_MAGIC(texture, -1);
2147 2139
2148 renderer = texture->renderer; 2140 renderer = texture->renderer;
2149 if (!renderer->SetTextureBlendMode) {
2150 SDL_Unsupported();
2151 return -1;
2152 }
2153 texture->blendMode = blendMode; 2141 texture->blendMode = blendMode;
2154 if (renderer->SetTextureBlendMode) { 2142 if (renderer->SetTextureBlendMode) {
2155 return renderer->SetTextureBlendMode(renderer, texture); 2143 return renderer->SetTextureBlendMode(renderer, texture);
2156 } else { 2144 } else {
2157 return 0; 2145 return 0;