diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-11-07 12:46:31 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-11-07 13:41:09 +0000 |
commit | 657a90eb30ea6f5f986fd4d886c0e709f20f2062 (patch) | |
tree | b46b666816b69ef1d7726c08e97dfceefc07df2f /source/fitz/draw-device.c | |
parent | 7456ccc6c3ec48490dffebaf26f85f9f5529fbe0 (diff) | |
download | mupdf-657a90eb30ea6f5f986fd4d886c0e709f20f2062.tar.xz |
Bug 697241: Fix blending through clips.
Non rectangular clips are currently handled by rendering to a
'isolated' background, and then plotting that through a mask.
This runs into problems when the rendering needs to use non
standard blend modes that need to access the background
colors.
Instead, copy the background to the new pixmap, render to that
then plot that through the mask.
This simplifies the painting code, because we now never have
mismatched source and destination alphas.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r-- | source/fitz/draw-device.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 1947115c..51d394f6 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -590,15 +590,8 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve { state[1].mask = fz_new_pixmap_with_bbox(ctx, NULL, &bbox, 1); fz_clear_pixmap(ctx, state[1].mask); - /* When there is no alpha in the current destination (state[0].dest->alpha == 0) - * we have a choice. We can either create the new destination WITH alpha, or - * we can copy the old pixmap contents in. We opt for the latter here, but - * may want to revisit this decision in future. */ state[1].dest = fz_new_pixmap_with_bbox(ctx, model, &bbox, state[0].dest->alpha); - if (state[0].dest->alpha) - fz_clear_pixmap(ctx, state[1].dest); - else - fz_copy_pixmap_rect(ctx, state[1].dest, state[0].dest, &bbox); + fz_copy_pixmap_rect(ctx, state[1].dest, state[0].dest, &bbox); if (state[1].shape) { state[1].shape = fz_new_pixmap_with_bbox(ctx, NULL, &bbox, 1); @@ -1895,10 +1888,7 @@ fz_draw_end_mask(fz_context *ctx, fz_device *devp) /* create new dest scratch buffer */ fz_pixmap_bbox(ctx, temp, &bbox); dest = fz_new_pixmap_with_bbox(ctx, state->dest->colorspace, &bbox, state->dest->alpha); - if (state->dest->alpha) - fz_clear_pixmap(ctx, dest); - else - fz_copy_pixmap_rect(ctx, dest, state->dest, &bbox); + fz_copy_pixmap_rect(ctx, dest, state->dest, &bbox); /* push soft mask as clip mask */ state[1].dest = dest; |