From 3fd587250b4039f674bc0f2c1fe29271315275c9 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 27 Sep 2017 16:27:11 +0100 Subject: Fix alpha group blend in CATX5233.pdf (Page 7). It seems we need to treat group alpha differently for isolated and non-isolated groups. --- source/fitz/draw-device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/fitz/draw-device.c') 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 -- cgit v1.2.3