Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11render.c @ 4617:cfbb1ff4b8ec
Add some comments.
author | Sunny Sachanandani <sunnysachanandani@gmail.com> |
---|---|
date | Wed, 28 Jul 2010 13:08:14 +0530 |
parents | 05eb4a07e5e3 |
children | 844b5ef4b149 |
comparison
equal
deleted
inserted
replaced
4616:05eb4a07e5e3 | 4617:cfbb1ff4b8ec |
---|---|
1036 | 1036 |
1037 if (renderdata->use_xrender) { | 1037 if (renderdata->use_xrender) { |
1038 | 1038 |
1039 Uint8 r = 0xFF, g = 0xFF, b = 0xFF, a = 0xFF; | 1039 Uint8 r = 0xFF, g = 0xFF, b = 0xFF, a = 0xFF; |
1040 | 1040 |
1041 /* Check if alpha modulation is required. */ | |
1041 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { | 1042 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { |
1042 a = texture->a; | 1043 a = texture->a; |
1043 } | 1044 } |
1044 | 1045 |
1046 /* Check if color modulation is required. */ | |
1045 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { | 1047 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { |
1046 r = texture->r; | 1048 r = texture->r; |
1047 g = texture->g; | 1049 g = texture->g; |
1048 b = texture->b; | 1050 b = texture->b; |
1049 } | 1051 } |
1050 | 1052 |
1053 /* We can save some labour if no modulation is required. */ | |
1051 if (texture->modMode != SDL_TEXTUREMODULATE_NONE) { | 1054 if (texture->modMode != SDL_TEXTUREMODULATE_NONE) { |
1052 XRenderColor mod_color = | 1055 XRenderColor mod_color = |
1053 SDLColorToXRenderColor(r, g, b, a); | 1056 SDLColorToXRenderColor(r, g, b, a); |
1054 XRenderFillRectangle(renderdata->display, PictOpSrc, | 1057 XRenderFillRectangle(renderdata->display, PictOpSrc, |
1055 renderdata->brush_pict, &mod_color, | 1058 renderdata->brush_pict, &mod_color, |
1056 0, 0, 1, 1); | 1059 0, 0, 1, 1); |
1057 } | 1060 } |
1058 | 1061 |
1062 /* We can save some labour dealing with component alpha | |
1063 * if color modulation is not required. */ | |
1059 XRenderPictureAttributes attr; | 1064 XRenderPictureAttributes attr; |
1060 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { | 1065 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { |
1061 attr.component_alpha = True; | 1066 attr.component_alpha = True; |
1062 XRenderChangePicture(renderdata->display, renderdata->brush_pict, | 1067 XRenderChangePicture(renderdata->display, renderdata->brush_pict, |
1063 CPComponentAlpha, &attr); | 1068 CPComponentAlpha, &attr); |
1064 } | 1069 } |
1065 | 1070 |
1071 /* Again none of this is necessary is no modulation | |
1072 * is required. */ | |
1066 if (texture->modMode != SDL_TEXTUREMODULATE_NONE) { | 1073 if (texture->modMode != SDL_TEXTUREMODULATE_NONE) { |
1067 XRenderComposite(renderdata->display, PictOpSrc, | 1074 XRenderComposite(renderdata->display, PictOpSrc, |
1068 data->picture, renderdata->brush_pict, | 1075 data->picture, renderdata->brush_pict, |
1069 data->modulated_picture, | 1076 data->modulated_picture, |
1070 0, 0, 0, 0, 0, 0, texture->w, texture->h); | 1077 0, 0, 0, 0, 0, 0, texture->w, texture->h); |
1071 } | 1078 } |
1072 | 1079 |
1080 /* We only need to reset the component alpha | |
1081 * attribute if color modulation is required. */ | |
1073 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { | 1082 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { |
1074 attr.component_alpha = False; | 1083 attr.component_alpha = False; |
1075 XRenderChangePicture(renderdata->display, renderdata->brush_pict, | 1084 XRenderChangePicture(renderdata->display, renderdata->brush_pict, |
1076 CPComponentAlpha, &attr); | 1085 CPComponentAlpha, &attr); |
1077 } | 1086 } |