Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11render.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 | 164bee619400 |
children | 619884e8a714 |
comparison
equal
deleted
inserted
replaced
4927:d716dff4b13e | 4929:aa8888658021 |
---|---|
81 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | | 81 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | |
82 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | | 82 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | |
83 SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED), | 83 SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED), |
84 SDL_TEXTUREMODULATE_NONE, | 84 SDL_TEXTUREMODULATE_NONE, |
85 SDL_BLENDMODE_NONE, | 85 SDL_BLENDMODE_NONE, |
86 SDL_TEXTURESCALEMODE_NONE, | 86 SDL_SCALEMODE_NONE, |
87 0, | 87 0, |
88 {0}, | 88 {0}, |
89 0, | 89 0, |
90 0} | 90 0} |
91 }; | 91 }; |
329 break; | 329 break; |
330 } | 330 } |
331 /* Update the capabilities of the renderer. */ | 331 /* Update the capabilities of the renderer. */ |
332 info->blend_modes |= (SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | | 332 info->blend_modes |= (SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | |
333 SDL_BLENDMODE_MOD | SDL_BLENDMODE_MASK); | 333 SDL_BLENDMODE_MOD | SDL_BLENDMODE_MASK); |
334 info->scale_modes |= (SDL_TEXTURESCALEMODE_FAST | SDL_TEXTURESCALEMODE_SLOW | | 334 info->scale_modes |= (SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW | |
335 SDL_TEXTURESCALEMODE_BEST); | 335 SDL_SCALEMODE_BEST); |
336 info->mod_modes |= (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA); | 336 info->mod_modes |= (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA); |
337 } | 337 } |
338 #endif | 338 #endif |
339 | 339 |
340 for (i = 0; i < _this->num_displays; ++i) { | 340 for (i = 0; i < _this->num_displays; ++i) { |
1076 return -1; | 1076 return -1; |
1077 } | 1077 } |
1078 // FIXME: Is the following required? | 1078 // FIXME: Is the following required? |
1079 /* Set the default blending and scaling modes. */ | 1079 /* Set the default blending and scaling modes. */ |
1080 texture->blendMode = SDL_BLENDMODE_NONE; | 1080 texture->blendMode = SDL_BLENDMODE_NONE; |
1081 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; | 1081 texture->scaleMode = SDL_SCALEMODE_NONE; |
1082 data->blend_op = PictOpSrc; | 1082 data->blend_op = PictOpSrc; |
1083 data->filter = NULL; | 1083 data->filter = NULL; |
1084 } | 1084 } |
1085 #endif | 1085 #endif |
1086 return 0; | 1086 return 0; |
1214 { | 1214 { |
1215 X11_TextureData *data = (X11_TextureData *) texture->driverdata; | 1215 X11_TextureData *data = (X11_TextureData *) texture->driverdata; |
1216 X11_RenderData *renderdata = (X11_RenderData *) renderer->driverdata; | 1216 X11_RenderData *renderdata = (X11_RenderData *) renderer->driverdata; |
1217 | 1217 |
1218 switch (texture->scaleMode) { | 1218 switch (texture->scaleMode) { |
1219 case SDL_TEXTURESCALEMODE_NONE: | 1219 case SDL_SCALEMODE_NONE: |
1220 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1220 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1221 if (renderdata->use_xrender) { | 1221 if (renderdata->use_xrender) { |
1222 data->filter = NULL; | 1222 data->filter = NULL; |
1223 } | 1223 } |
1224 #endif | 1224 #endif |
1225 return 0; | 1225 return 0; |
1226 case SDL_TEXTURESCALEMODE_FAST: | 1226 case SDL_SCALEMODE_FAST: |
1227 /* We can sort of fake it for streaming textures */ | 1227 /* We can sort of fake it for streaming textures */ |
1228 if (data->yuv || texture->access == SDL_TEXTUREACCESS_STREAMING) { | 1228 if (data->yuv || texture->access == SDL_TEXTUREACCESS_STREAMING) { |
1229 return 0; | 1229 return 0; |
1230 } | 1230 } |
1231 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1231 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1232 if (renderdata->use_xrender) { | 1232 if (renderdata->use_xrender) { |
1233 data->filter = FilterFast; | 1233 data->filter = FilterFast; |
1234 return 0; | 1234 return 0; |
1235 } | 1235 } |
1236 case SDL_TEXTURESCALEMODE_SLOW: | 1236 case SDL_SCALEMODE_SLOW: |
1237 if (renderdata->use_xrender) { | 1237 if (renderdata->use_xrender) { |
1238 data->filter = FilterGood; | 1238 data->filter = FilterGood; |
1239 return 0; | 1239 return 0; |
1240 } | 1240 } |
1241 case SDL_TEXTURESCALEMODE_BEST: | 1241 case SDL_SCALEMODE_BEST: |
1242 if (renderdata->use_xrender) { | 1242 if (renderdata->use_xrender) { |
1243 data->filter = FilterBest; | 1243 data->filter = FilterBest; |
1244 return 0; | 1244 return 0; |
1245 } | 1245 } |
1246 #endif | 1246 #endif |
1247 /* Fall through to unsupported case */ | 1247 /* Fall through to unsupported case */ |
1248 default: | 1248 default: |
1249 SDL_Unsupported(); | 1249 SDL_Unsupported(); |
1250 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1250 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1251 if (renderdata->use_xrender) { | 1251 if (renderdata->use_xrender) { |
1252 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; | 1252 texture->scaleMode = SDL_SCALEMODE_NONE; |
1253 data->filter = NULL; | 1253 data->filter = NULL; |
1254 } | 1254 } |
1255 else | 1255 else |
1256 #endif | 1256 #endif |
1257 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; | 1257 texture->scaleMode = SDL_SCALEMODE_NONE; |
1258 return -1; | 1258 return -1; |
1259 } | 1259 } |
1260 return 0; | 1260 return 0; |
1261 } | 1261 } |
1262 | 1262 |
2010 XRenderChangePicture(data->display, data->stencil_pict, | 2010 XRenderChangePicture(data->display, data->stencil_pict, |
2011 CPComponentAlpha, &attr); | 2011 CPComponentAlpha, &attr); |
2012 } | 2012 } |
2013 | 2013 |
2014 /* Set the picture filter only if a scaling mode is set. */ | 2014 /* Set the picture filter only if a scaling mode is set. */ |
2015 if (texture->scaleMode != SDL_TEXTURESCALEMODE_NONE) { | 2015 if (texture->scaleMode != SDL_SCALEMODE_NONE) { |
2016 XRenderSetPictureFilter(data->display, src, | 2016 XRenderSetPictureFilter(data->display, src, |
2017 texturedata->filter, 0, 0); | 2017 texturedata->filter, 0, 0); |
2018 } | 2018 } |
2019 | 2019 |
2020 XRenderComposite(data->display, texturedata->blend_op, | 2020 XRenderComposite(data->display, texturedata->blend_op, |