diff 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
line wrap: on
line diff
--- 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,