# HG changeset patch # User Sunny Sachanandani # Date 1280302694 -19800 # Node ID cfbb1ff4b8ec33809b18d8fd09faa57ab41e6fd0 # Parent 05eb4a07e5e386bd1d171e4bd10648ff50a6e084 Add some comments. diff -r 05eb4a07e5e3 -r cfbb1ff4b8ec src/video/x11/SDL_x11render.c --- a/src/video/x11/SDL_x11render.c Wed Jul 28 11:56:17 2010 +0530 +++ b/src/video/x11/SDL_x11render.c Wed Jul 28 13:08:14 2010 +0530 @@ -1038,16 +1038,19 @@ Uint8 r = 0xFF, g = 0xFF, b = 0xFF, a = 0xFF; + /* Check if alpha modulation is required. */ if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { a = texture->a; } + /* Check if color modulation is required. */ if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { r = texture->r; g = texture->g; b = texture->b; } + /* We can save some labour if no modulation is required. */ if (texture->modMode != SDL_TEXTUREMODULATE_NONE) { XRenderColor mod_color = SDLColorToXRenderColor(r, g, b, a); @@ -1056,6 +1059,8 @@ 0, 0, 1, 1); } + /* We can save some labour dealing with component alpha + * if color modulation is not required. */ XRenderPictureAttributes attr; if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { attr.component_alpha = True; @@ -1063,6 +1068,8 @@ CPComponentAlpha, &attr); } + /* Again none of this is necessary is no modulation + * is required. */ if (texture->modMode != SDL_TEXTUREMODULATE_NONE) { XRenderComposite(renderdata->display, PictOpSrc, data->picture, renderdata->brush_pict, @@ -1070,6 +1077,8 @@ 0, 0, 0, 0, 0, 0, texture->w, texture->h); } + /* We only need to reset the component alpha + * attribute if color modulation is required. */ if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { attr.component_alpha = False; XRenderChangePicture(renderdata->display, renderdata->brush_pict,