comparison src/video/SDL_video.c @ 4929:aa8888658021

Use the enumerated type for blend and scale mode instead of int Renamed SDL_TextureScaleMode to SDL_ScaleMode
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Dec 2010 15:19:05 -0800
parents 6b89d83b0b5a
children 85969cc5098c
comparison
equal deleted inserted replaced
4927:d716dff4b13e 4929:aa8888658021
1957 } 1957 }
1958 } 1958 }
1959 1959
1960 { 1960 {
1961 Uint8 r, g, b, a; 1961 Uint8 r, g, b, a;
1962 int blendMode; 1962 SDL_BlendMode blendMode;
1963 int scaleMode; 1963 SDL_ScaleMode scaleMode;
1964 1964
1965 SDL_GetSurfaceColorMod(surface, &r, &g, &b); 1965 SDL_GetSurfaceColorMod(surface, &r, &g, &b);
1966 SDL_SetTextureColorMod(texture, r, g, b); 1966 SDL_SetTextureColorMod(texture, r, g, b);
1967 1967
1968 SDL_GetSurfaceAlphaMod(surface, &a); 1968 SDL_GetSurfaceAlphaMod(surface, &a);
2127 } 2127 }
2128 return 0; 2128 return 0;
2129 } 2129 }
2130 2130
2131 int 2131 int
2132 SDL_SetTextureBlendMode(SDL_Texture * texture, int blendMode) 2132 SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode)
2133 { 2133 {
2134 SDL_Renderer *renderer; 2134 SDL_Renderer *renderer;
2135 2135
2136 CHECK_TEXTURE_MAGIC(texture, -1); 2136 CHECK_TEXTURE_MAGIC(texture, -1);
2137 2137
2143 texture->blendMode = blendMode; 2143 texture->blendMode = blendMode;
2144 return renderer->SetTextureBlendMode(renderer, texture); 2144 return renderer->SetTextureBlendMode(renderer, texture);
2145 } 2145 }
2146 2146
2147 int 2147 int
2148 SDL_GetTextureBlendMode(SDL_Texture * texture, int *blendMode) 2148 SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode)
2149 { 2149 {
2150 CHECK_TEXTURE_MAGIC(texture, -1); 2150 CHECK_TEXTURE_MAGIC(texture, -1);
2151 2151
2152 if (blendMode) { 2152 if (blendMode) {
2153 *blendMode = texture->blendMode; 2153 *blendMode = texture->blendMode;
2154 } 2154 }
2155 return 0; 2155 return 0;
2156 } 2156 }
2157 2157
2158 int 2158 int
2159 SDL_SetTextureScaleMode(SDL_Texture * texture, int scaleMode) 2159 SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode)
2160 { 2160 {
2161 SDL_Renderer *renderer; 2161 SDL_Renderer *renderer;
2162 2162
2163 CHECK_TEXTURE_MAGIC(texture, -1); 2163 CHECK_TEXTURE_MAGIC(texture, -1);
2164 2164
2170 texture->scaleMode = scaleMode; 2170 texture->scaleMode = scaleMode;
2171 return renderer->SetTextureScaleMode(renderer, texture); 2171 return renderer->SetTextureScaleMode(renderer, texture);
2172 } 2172 }
2173 2173
2174 int 2174 int
2175 SDL_GetTextureScaleMode(SDL_Texture * texture, int *scaleMode) 2175 SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode)
2176 { 2176 {
2177 CHECK_TEXTURE_MAGIC(texture, -1); 2177 CHECK_TEXTURE_MAGIC(texture, -1);
2178 2178
2179 if (scaleMode) { 2179 if (scaleMode) {
2180 *scaleMode = texture->scaleMode; 2180 *scaleMode = texture->scaleMode;
2313 } 2313 }
2314 return 0; 2314 return 0;
2315 } 2315 }
2316 2316
2317 int 2317 int
2318 SDL_SetRenderDrawBlendMode(int blendMode) 2318 SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode)
2319 { 2319 {
2320 SDL_Renderer *renderer; 2320 SDL_Renderer *renderer;
2321 2321
2322 renderer = SDL_GetCurrentRenderer(SDL_TRUE); 2322 renderer = SDL_GetCurrentRenderer(SDL_TRUE);
2323 if (!renderer) { 2323 if (!renderer) {
2330 return 0; 2330 return 0;
2331 } 2331 }
2332 } 2332 }
2333 2333
2334 int 2334 int
2335 SDL_GetRenderDrawBlendMode(int *blendMode) 2335 SDL_GetRenderDrawBlendMode(SDL_BlendMode *blendMode)
2336 { 2336 {
2337 SDL_Renderer *renderer; 2337 SDL_Renderer *renderer;
2338 2338
2339 renderer = SDL_GetCurrentRenderer(SDL_TRUE); 2339 renderer = SDL_GetCurrentRenderer(SDL_TRUE);
2340 if (!renderer) { 2340 if (!renderer) {
2352 renderer = SDL_GetCurrentRenderer(SDL_TRUE); 2352 renderer = SDL_GetCurrentRenderer(SDL_TRUE);
2353 if (!renderer) { 2353 if (!renderer) {
2354 return -1; 2354 return -1;
2355 } 2355 }
2356 if (!renderer->RenderClear) { 2356 if (!renderer->RenderClear) {
2357 int blendMode = renderer->blendMode; 2357 SDL_BlendMode blendMode = renderer->blendMode;
2358 int status; 2358 int status;
2359 2359
2360 if (blendMode >= SDL_BLENDMODE_BLEND) { 2360 if (blendMode >= SDL_BLENDMODE_BLEND) {
2361 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); 2361 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
2362 } 2362 }