diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2021-06-17 17:32:45 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2021-06-18 12:32:21 +0100 |
commit | ce6f41377ed6424853ec1bbc1b7fd2751a0fca3f (patch) | |
tree | 0bf6741142344507d165d62d310ac42e529b6104 | |
parent | 57735195ddd61b4fc574d788b7afc7b3a772c51c (diff) | |
download | ghostpdl-ce6f41377ed6424853ec1bbc1b7fd2751a0fca3f.tar.gz |
Remove 'alpha' field from gx_device_color.
This field is set to gx_max_color_value on creation. It is then
encoded/decoded, copied around and serialised/deserialised, but
can never actually be set to any other value.
Strip out the code that knocks on from this.
-rw-r--r-- | base/gdevplnx.c | 4 | ||||
-rw-r--r-- | base/gsdcolor.h | 2 | ||||
-rw-r--r-- | base/gxcht.c | 39 | ||||
-rw-r--r-- | base/gxdcolor.c | 1 |
4 files changed, 1 insertions, 45 deletions
diff --git a/base/gdevplnx.c b/base/gdevplnx.c index 52b490b8f..58c3da2f7 100644 --- a/base/gdevplnx.c +++ b/base/gdevplnx.c @@ -185,9 +185,7 @@ reduce_drawing_color(gx_device_color *ppdc, gx_device_plane_extract *edev, gx_devn_reduce_colored_halftone(ppdc, (gx_device *)edev); ppdc->colors.pure = COLOR_PIXEL(edev, ppdc->colors.pure); reduced = REDUCE_PURE(edev, gx_dc_pure_color(ppdc)); - } else if (ppdc->colors.colored.alpha != gx_max_color_value) - return REDUCE_FAILED; /* can't reduce */ - else { + } else { gx_devn_reduce_colored_halftone(ppdc, (gx_device *)edev); ppdc->colors.binary.color[0] = COLOR_PIXEL(edev, ppdc->colors.binary.color[0]); diff --git a/base/gsdcolor.h b/base/gsdcolor.h index 367dcd487..253799ede 100644 --- a/base/gsdcolor.h +++ b/base/gsdcolor.h @@ -271,7 +271,6 @@ struct gx_device_color_s { ushort num_components; byte c_base[GX_DEVICE_COLOR_MAX_COMPONENTS]; uint c_level[GX_DEVICE_COLOR_MAX_COMPONENTS]; - ushort /*gx_color_value */ alpha; #if GX_DEVICE_COLOR_MAX_COMPONENTS <= ARCH_SIZEOF_SHORT * 8 ushort plane_mask; #else @@ -371,7 +370,6 @@ struct gx_device_color_saved_s { struct _svcol { byte c_base[GX_DEVICE_COLOR_MAX_COMPONENTS]; uint c_level[GX_DEVICE_COLOR_MAX_COMPONENTS]; - ushort alpha; } colored; struct _svdevn { ushort values[GX_DEVICE_COLOR_MAX_COMPONENTS]; diff --git a/base/gxcht.c b/base/gxcht.c index fa40565a3..ed9868d37 100644 --- a/base/gxcht.c +++ b/base/gxcht.c @@ -85,7 +85,6 @@ gx_dc_ht_colored_save_dc(const gx_device_color * pdevc, memcpy( psdc->colors.colored.c_level, pdevc->colors.colored.c_level, sizeof(psdc->colors.colored.c_base) ); - psdc->colors.colored.alpha = pdevc->colors.colored.alpha; psdc->phase = pdevc->phase; } @@ -105,7 +104,6 @@ gx_dc_ht_colored_equal(const gx_device_color * pdevc1, if (pdevc2->type != pdevc1->type || pdevc1->colors.colored.c_ht != pdevc2->colors.colored.c_ht || - pdevc1->colors.colored.alpha != pdevc2->colors.colored.alpha || pdevc1->phase.x != pdevc2->phase.x || pdevc1->phase.y != pdevc2->phase.y || num_comp != pdevc2->colors.colored.num_components @@ -133,8 +131,6 @@ gx_dc_ht_colored_equal(const gx_device_color * pdevc1, */ static const int dc_ht_colored_has_base = 0x01; static const int dc_ht_colored_has_level = 0x02; -static const int dc_ht_colored_has_alpha = 0x04; -static const int dc_ht_colored_alpha_is_max = 0x08; /* * Serialize a device color that uses a traditional colored halftone. @@ -196,7 +192,6 @@ gx_dc_ht_colored_write( int num_comps = dev->color_info.num_components; int depth = dev->color_info.depth; gx_color_index plane_mask = pdevc->colors.colored.plane_mask; - gx_color_value alpha = pdevc->colors.colored.alpha; const gx_device_color_saved * psdc = psdc0; byte * pdata0 = pdata; @@ -248,15 +243,6 @@ gx_dc_ht_colored_write( } } - if (psdc == 0 || alpha != psdc->colors.colored.alpha) { - if (alpha == gx_max_color_value) - flag_bits |= dc_ht_colored_alpha_is_max; - else { - flag_bits |= dc_ht_colored_has_alpha; - req_size += enc_u_sizew(alpha); - } - } - /* see if there is anything to do */ if (flag_bits == 0) { *psize = 0; @@ -313,9 +299,6 @@ gx_dc_ht_colored_write( } } - if ((flag_bits & dc_ht_colored_has_alpha) != 0) - enc_u_putw(alpha, pdata); - *psize = pdata - pdata0; return 0; } @@ -447,17 +430,6 @@ gx_dc_ht_colored_read( size -= pdata - pdata_start; } - if ((flag_bits & dc_ht_colored_alpha_is_max) != 0) - devc.colors.colored.alpha = gx_max_color_value; - else if ((flag_bits & dc_ht_colored_has_alpha) != 0) { - const byte * pdata_start = pdata; - - if (size < 1) - return_error(gs_error_rangecheck); - enc_u_getw(devc.colors.colored.alpha, pdata); - size -= pdata - pdata_start; - } - /* set the phase as required (select value is arbitrary) */ color_set_phase_mod( &devc, pgs->screen_phase[0].x, @@ -871,9 +843,6 @@ set_ht_colors_le_4(color_values_pair_t *pvp /* only used internally */, set_plane_color(2, pvp, pdc, sbits, caches, max_color, invert); } if (nplanes == 3) { - gx_color_value alpha = pdc->colors.colored.alpha; - - if (alpha == gx_max_color_value) { #define M(i)\ cvalues[0] = pvp->values[(i) & 1][0];\ cvalues[1] = pvp->values[((i) & 2) >> 1][1];\ @@ -882,14 +851,6 @@ set_ht_colors_le_4(color_values_pair_t *pvp /* only used internally */, M(0); M(1); M(2); M(3); M(4); M(5); M(6); M(7); #undef M - } else { -#define M(i)\ - colors[i] = dev_proc(dev, map_rgb_alpha_color)(dev, pvp->values[(i) & 1][0],\ - pvp->values[((i) & 2) >> 1][1],\ - pvp->values[(i) >> 2][2], alpha) - M(0); M(1); M(2); M(3); M(4); M(5); M(6); M(7); -#undef M - } } else if (nplanes > 3){ set_plane_color(3, pvp, pdc, sbits, caches, max_color, invert); if (nplanes > 4) { diff --git a/base/gxdcolor.c b/base/gxdcolor.c index dbd1b57bc..87de80019 100644 --- a/base/gxdcolor.c +++ b/base/gxdcolor.c @@ -1026,7 +1026,6 @@ gx_complete_halftone(gx_device_color *pdevc, int num_comps, gx_device_halftone * pdevc->type = gx_dc_type_ht_colored; pdevc->colors.colored.c_ht = pdht; pdevc->colors.colored.num_components = num_comps; - pdevc->colors.colored.alpha = max_ushort; for (i = 0; i < num_comps; i++) mask |= ((pdevc->colors.colored.c_level[i] != 0 ? 1 : 0) << i); pdevc->colors.colored.plane_mask = mask; |