diff options
author | Robin Watts <robin.watts@artifex.com> | 2017-09-27 16:27:11 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-10-24 15:16:37 +0100 |
commit | 3fd587250b4039f674bc0f2c1fe29271315275c9 (patch) | |
tree | 206407b9db911d22253d9c0c3b87aaf38a3f9434 | |
parent | 23f3e2a2495bc3889cd7da1e6537f674846add80 (diff) | |
download | mupdf-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.
-rw-r--r-- | source/fitz/draw-device.c | 10 |
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 |