[gimp] app/display: fix cairo drawing of transform tool image preview



commit 2f3c6af28bb8ce551600ae65d3bc3508549b2bab
Author: Sven Neumann <sven gimp org>
Date:   Sun Sep 26 22:15:07 2010 +0200

    app/display: fix cairo drawing of transform tool image preview
    
    Don't access the cairo image surface directly, instead use the
    GIMP_CAIRO_ARGB32_SET_PIXEL() macro that takes care of
    pre-multiplying the colors by the pixels alpha component.

 app/display/gimpdisplayshell-preview.c |   54 +++++++++++++++++--------------
 1 files changed, 30 insertions(+), 24 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-preview.c b/app/display/gimpdisplayshell-preview.c
index 2ef0e7d..e90aa47 100644
--- a/app/display/gimpdisplayshell-preview.c
+++ b/app/display/gimpdisplayshell-preview.c
@@ -901,10 +901,11 @@ gimp_display_shell_draw_tri_row_mask (GimpDrawable    *texture,
 
           offset = pixel[0] + pixel[0] + pixel[0];
 
-          pptr[0] = cmap[offset + 0];
-          pptr[1] = cmap[offset + 1];
-          pptr[2] = cmap[offset + 2];
-          pptr[3] = INT_MULT (opacity, maskval, tmp);
+          GIMP_CAIRO_ARGB32_SET_PIXEL (pptr,
+                                       cmap[offset + 0],
+                                       cmap[offset + 1],
+                                       cmap[offset + 2],
+                                       INT_MULT (opacity, maskval, tmp));
 
           pptr += 4;
 
@@ -927,10 +928,11 @@ gimp_display_shell_draw_tri_row_mask (GimpDrawable    *texture,
 
           offset = pixel[0] + pixel[0] + pixel[0];
 
-          pptr[0] = cmap[offset + 0];
-          pptr[1] = cmap[offset + 1];
-          pptr[2] = cmap[offset + 2];
-          pptr[3] = INT_MULT3 (opacity, maskval, pixel[1], tmp);
+          GIMP_CAIRO_ARGB32_SET_PIXEL (pptr,
+                                       cmap[offset + 0],
+                                       cmap[offset + 1],
+                                       cmap[offset + 2],
+                                       INT_MULT3 (opacity, maskval, pixel[1], tmp));
 
           pptr += 4;
 
@@ -949,10 +951,11 @@ gimp_display_shell_draw_tri_row_mask (GimpDrawable    *texture,
           read_pixel_data_1 (tiles, (gint) u, (gint) v, pixel);
           read_pixel_data_1 (masktiles, (gint) mu, (gint) mv, &maskval);
 
-          pptr[0] = pixel[0];
-          pptr[1] = pixel[0];
-          pptr[2] = pixel[0];
-          pptr[3] = INT_MULT (opacity, maskval, tmp);
+          GIMP_CAIRO_ARGB32_SET_PIXEL (pptr,
+                                       pixel[0],
+                                       pixel[0],
+                                       pixel[0],
+                                       INT_MULT (opacity, maskval, tmp));
 
           pptr += 4;
 
@@ -971,10 +974,11 @@ gimp_display_shell_draw_tri_row_mask (GimpDrawable    *texture,
           read_pixel_data_1 (tiles, (gint) u, (gint) v, pixel);
           read_pixel_data_1 (masktiles, (gint) mu, (gint) mv, &maskval);
 
-          pptr[0] = pixel[0];
-          pptr[1] = pixel[0];
-          pptr[2] = pixel[0];
-          pptr[3] = INT_MULT3 (opacity, maskval, pixel[1], tmp);
+          GIMP_CAIRO_ARGB32_SET_PIXEL (pptr,
+                                       pixel[0],
+                                       pixel[0],
+                                       pixel[0],
+                                       INT_MULT3 (opacity, maskval, pixel[1], tmp));
 
           pptr += 4;
 
@@ -993,10 +997,11 @@ gimp_display_shell_draw_tri_row_mask (GimpDrawable    *texture,
           read_pixel_data_1 (tiles, (gint) u, (gint) v, pixel);
           read_pixel_data_1 (masktiles, (gint) mu, (gint) mv, &maskval);
 
-          pptr[0] = pixel[0];
-          pptr[1] = pixel[1];
-          pptr[2] = pixel[2];
-          pptr[3] = INT_MULT (opacity, maskval, tmp);
+          GIMP_CAIRO_ARGB32_SET_PIXEL (pptr,
+                                       pixel[0],
+                                       pixel[1],
+                                       pixel[2],
+                                       INT_MULT (opacity, maskval, tmp));
 
           pptr += 4;
 
@@ -1015,10 +1020,11 @@ gimp_display_shell_draw_tri_row_mask (GimpDrawable    *texture,
           read_pixel_data_1 (tiles, (gint) u, (gint) v, pixel);
           read_pixel_data_1 (masktiles, (gint) mu, (gint) mv, &maskval);
 
-          pptr[0] = pixel[0];
-          pptr[1] = pixel[1];
-          pptr[2] = pixel[2];
-          pptr[3] = INT_MULT3 (opacity, maskval, pixel[3], tmp);
+          GIMP_CAIRO_ARGB32_SET_PIXEL (pptr,
+                                       pixel[0],
+                                       pixel[1],
+                                       pixel[2],
+                                       INT_MULT3 (opacity, maskval, pixel[3], tmp));
 
           pptr += 4;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]