comparison src/video/photon/SDL_photon_render.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 f7b03b6838cb
children da10636e5eca
comparison
equal deleted inserted replaced
4927:d716dff4b13e 4929:aa8888658021
102 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | 102 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
103 SDL_RENDERER_ACCELERATED), 103 SDL_RENDERER_ACCELERATED),
104 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA), 104 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA),
105 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | 105 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND |
106 SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), 106 SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
107 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW | 107 (SDL_SCALEMODE_NONE | SDL_SCALEMODE_SLOW | SDL_SCALEMODE_FAST),
108 SDL_TEXTURESCALEMODE_FAST),
109 10, 108 10,
110 {SDL_PIXELFORMAT_INDEX8, 109 {SDL_PIXELFORMAT_INDEX8,
111 SDL_PIXELFORMAT_RGB555, 110 SDL_PIXELFORMAT_RGB555,
112 SDL_PIXELFORMAT_RGB565, 111 SDL_PIXELFORMAT_RGB565,
113 SDL_PIXELFORMAT_RGB24, 112 SDL_PIXELFORMAT_RGB24,
252 _photon_recreate_surfaces(renderer); 251 _photon_recreate_surfaces(renderer);
253 252
254 /* Set current scale blitting capabilities */ 253 /* Set current scale blitting capabilities */
255 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_OFFSCREEN) 254 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_OFFSCREEN)
256 { 255 {
257 renderer->info.scale_modes=SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW; 256 renderer->info.scale_modes=SDL_SCALEMODE_NONE | SDL_SCALEMODE_SLOW;
258 if ((didata->mode_2dcaps & SDL_VIDEO_PHOTON_CAP_SCALED_BLIT)==SDL_VIDEO_PHOTON_CAP_SCALED_BLIT) 257 if ((didata->mode_2dcaps & SDL_VIDEO_PHOTON_CAP_SCALED_BLIT)==SDL_VIDEO_PHOTON_CAP_SCALED_BLIT)
259 { 258 {
260 /* This video mode supports hardware scaling */ 259 /* This video mode supports hardware scaling */
261 renderer->info.scale_modes|=SDL_TEXTURESCALEMODE_FAST; 260 renderer->info.scale_modes|=SDL_SCALEMODE_FAST;
262 } 261 }
263 } 262 }
264 else 263 else
265 { 264 {
266 /* PhImage blit functions do not support scaling */ 265 /* PhImage blit functions do not support scaling */
267 renderer->info.scale_modes=SDL_TEXTURESCALEMODE_NONE; 266 renderer->info.scale_modes=SDL_SCALEMODE_NONE;
268 } 267 }
269 268
270 return renderer; 269 return renderer;
271 } 270 }
272 271
982 { 981 {
983 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; 982 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
984 983
985 switch (texture->scaleMode) 984 switch (texture->scaleMode)
986 { 985 {
987 case SDL_TEXTURESCALEMODE_NONE: 986 case SDL_SCALEMODE_NONE:
988 return 0; 987 return 0;
989 case SDL_TEXTURESCALEMODE_FAST: 988 case SDL_SCALEMODE_FAST:
990 if ((renderer->info.scale_modes & SDL_TEXTURESCALEMODE_FAST)==SDL_TEXTURESCALEMODE_FAST) 989 if ((renderer->info.scale_modes & SDL_SCALEMODE_FAST)==SDL_SCALEMODE_FAST)
991 { 990 {
992 return 0; 991 return 0;
993 } 992 }
994 else 993 else
995 { 994 {
996 SDL_Unsupported(); 995 SDL_Unsupported();
997 texture->scaleMode = SDL_TEXTURESCALEMODE_FAST; 996 texture->scaleMode = SDL_SCALEMODE_FAST;
998 return -1; 997 return -1;
999 } 998 }
1000 break; 999 break;
1001 case SDL_TEXTURESCALEMODE_SLOW: 1000 case SDL_SCALEMODE_SLOW:
1002 if ((renderer->info.scale_modes & SDL_TEXTURESCALEMODE_SLOW)==SDL_TEXTURESCALEMODE_SLOW) 1001 if ((renderer->info.scale_modes & SDL_SCALEMODE_SLOW)==SDL_SCALEMODE_SLOW)
1003 { 1002 {
1004 return 0; 1003 return 0;
1005 } 1004 }
1006 else 1005 else
1007 { 1006 {
1008 SDL_Unsupported(); 1007 SDL_Unsupported();
1009 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW; 1008 texture->scaleMode = SDL_SCALEMODE_SLOW;
1010 return -1; 1009 return -1;
1011 } 1010 }
1012 break; 1011 break;
1013 case SDL_TEXTURESCALEMODE_BEST: 1012 case SDL_SCALEMODE_BEST:
1014 SDL_Unsupported(); 1013 SDL_Unsupported();
1015 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW; 1014 texture->scaleMode = SDL_SCALEMODE_SLOW;
1016 return -1; 1015 return -1;
1017 default: 1016 default:
1018 SDL_Unsupported(); 1017 SDL_Unsupported();
1019 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; 1018 texture->scaleMode = SDL_SCALEMODE_NONE;
1020 return -1; 1019 return -1;
1021 } 1020 }
1022 1021
1023 SDL_Unsupported(); 1022 SDL_Unsupported();
1024 return -1; 1023 return -1;