Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Add some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyps committed Jul 28, 2010
1 parent 7b85682 commit c6dd756
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/video/x11/SDL_x11render.c
Expand Up @@ -1038,16 +1038,19 @@ X11_SetTextureRGBAMod(SDL_Renderer * renderer, SDL_Texture * texture)

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);
Expand All @@ -1056,20 +1059,26 @@ X11_SetTextureRGBAMod(SDL_Renderer * renderer, SDL_Texture * texture)
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;
XRenderChangePicture(renderdata->display, renderdata->brush_pict,
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,
data->modulated_picture,
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,
Expand Down

0 comments on commit c6dd756

Please sign in to comment.