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.
This commit is contained in:
Sven Neumann 2010-09-26 22:15:07 +02:00
parent 8f9ffe597d
commit 2f3c6af28b
1 changed files with 30 additions and 24 deletions

View File

@ -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;