summaryrefslogtreecommitdiff
path: root/source/fitz/draw-device.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-09-27 16:27:11 +0100
committerRobin Watts <robin.watts@artifex.com>2017-10-24 15:16:37 +0100
commit3fd587250b4039f674bc0f2c1fe29271315275c9 (patch)
tree206407b9db911d22253d9c0c3b87aaf38a3f9434 /source/fitz/draw-device.c
parent23f3e2a2495bc3889cd7da1e6537f674846add80 (diff)
downloadmupdf-3fd587250b4039f674bc0f2c1fe29271315275c9.tar.xz
Fix alpha group blend in CATX5233.pdf (Page 7).
It seems we need to treat group alpha differently for isolated and non-isolated groups.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r--source/fitz/draw-device.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 740f817e..4ba14f69 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -2430,12 +2430,14 @@ fz_draw_end_group(fz_context *ctx, fz_device *devp)
assert(state[0].group_alpha == NULL || state[0].group_alpha != state[1].group_alpha);
if (state[0].group_alpha && state[0].group_alpha != state[1].group_alpha)
{
- /* The 'D' on page 7 of Altona_Technical_v20_x4.pdf goes wrong if this
- * is 255 * alpha, as an alpha effectively gets applied twice. */
+ /* The 'D' on page 7 of Altona_Technical_v20_x4.pdf uses an isolated group,
+ * and goes wrong if this is 255 * alpha, as an alpha effectively gets
+ * applied twice. CATX5233 page 7 uses a non-isolated group, and goes wrong
+ * if alpha isn't applied here. */
if (state[1].group_alpha)
- fz_paint_pixmap(state[0].group_alpha, state[1].group_alpha, 255);
+ fz_paint_pixmap(state[0].group_alpha, state[1].group_alpha, isolated ? 255 : alpha * 255);
else
- fz_paint_pixmap_alpha(state[0].group_alpha, state[1].dest, 255);
+ fz_paint_pixmap_alpha(state[0].group_alpha, state[1].dest, isolated ? 255 : alpha * 255);
}
fz_drop_pixmap(ctx, state[1].group_alpha);
/* The following test should not be required, but just occasionally