summaryrefslogtreecommitdiff
path: root/gs/base/gxblend1.c
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2010-09-23 19:45:27 +0000
committerMichael Vrhel <michael.vrhel@artifex.com>2010-09-23 19:45:27 +0000
commit0d6d928a0d96206d40c9d465c9453976556fcdd7 (patch)
treeb189c46c76081d6ed8488b860498be8521919bf5 /gs/base/gxblend1.c
parentbdfd9a0dba73dc3408a27c5d95c63bdd6c23f63f (diff)
downloadghostpdl-0d6d928a0d96206d40c9d465c9453976556fcdd7.tar.gz
Fix so that objects tag information makes it through transparency rendering AND the clist. An issue was that the pdf14 encode and decode procedures are used as opposed to the target device encode and decode procedures and it is through a value in the color index that we currently communicate the object type through the clist. When we are in page rendering mode, it is easy to get the current object from mem->gs_lib_ctx->BITTAG, but this is not set correctly in clist rendering if for example a glyph is stored in the clist as a mask fill. Instead the information about the object is extracted from the color index. So, to make this work, we had to introduce an encode method for the pdf14 device that incorporates the tag information and also make sure that the bit depth for the pdf14 color info value is incremented appropriately so that the extra byte is stored and extracted from the clist. The object type is then recovered during the pdf14 mark fill rect procedure. This was tested with the updated bitrgbtags device using a custom file that has overlapping text, image and path objects with varying transparency amounts.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11739 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/base/gxblend1.c')
-rw-r--r--gs/base/gxblend1.c76
1 files changed, 27 insertions, 49 deletions
diff --git a/gs/base/gxblend1.c b/gs/base/gxblend1.c
index bba06dc52..4b5859073 100644
--- a/gs/base/gxblend1.c
+++ b/gs/base/gxblend1.c
@@ -145,7 +145,6 @@ extern unsigned int global_index;
void
pdf14_preserve_backdrop(pdf14_buf *buf, pdf14_buf *tos, bool has_shape)
{
-
/* make copy of backdrop for compositing */
int x0 = max(buf->rect.p.x, tos->rect.p.x);
int x1 = min(buf->rect.q.x, tos->rect.q.x);
@@ -158,47 +157,40 @@ pdf14_preserve_backdrop(pdf14_buf *buf, pdf14_buf *tos, bool has_shape)
byte *tos_plane = tos->data + x0 - tos->rect.p.x + (y0 - tos->rect.p.y) * tos->rowstride;
int i;
/*int n_chan_copy = buf->n_chan + (tos->has_shape ? 1 : 0);*/
- int n_chan_copy = tos->n_chan + (tos->has_shape ? 1 : 0);
+ int n_chan_copy = tos->n_chan + (tos->has_shape ? 1 : 0) + (tos->has_tags ? 1 : 0);
for (i = 0; i < n_chan_copy; i++) {
- byte *buf_ptr = buf_plane;
- byte *tos_ptr = tos_plane;
- int y;
-
- for (y = y0; y < y1; ++y) {
- memcpy (buf_ptr, tos_ptr, width);
- buf_ptr += buf->rowstride;
- tos_ptr += tos->rowstride;
- }
- buf_plane += buf->planestride;
- tos_plane += tos->planestride;
+ byte *buf_ptr = buf_plane;
+ byte *tos_ptr = tos_plane;
+ int y;
+
+ for (y = y0; y < y1; ++y) {
+ memcpy (buf_ptr, tos_ptr, width);
+ buf_ptr += buf->rowstride;
+ tos_ptr += tos->rowstride;
}
- if (has_shape && !tos->has_shape)
- memset (buf_plane, 0, buf->planestride);
+ buf_plane += buf->planestride;
+ tos_plane += tos->planestride;
+ }
+ if (has_shape && !tos->has_shape) {
+ if (tos->has_tags) {
+ buf_plane -= buf->planestride;
+ }
+ memset (buf_plane, 0, buf->planestride);
+ }
}
-
-
#if RAW_DUMP
-
if (x0 < x1 && y0 < y1) {
-
byte *buf_plane = buf->data + x0 - buf->rect.p.x +
(y0 - buf->rect.p.y) * buf->rowstride;
-
dump_raw_buffer(y1-y0, x1 - x0, buf->n_planes,
buf->planestride, buf->rowstride,
"BackDropInit",buf_plane);
-
global_index++;
-
}
-
#endif
-
}
-
-
void
pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
int x0, int x1, int y0, int y1, int n_chan, bool additive,
@@ -426,16 +418,15 @@ pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
}
/*
- * Encode a list of smask colorant values into a gx_color_index_value.
- * This has its own encoder as it may have a different number of colorants
- * compared to the actual device.
+ * Encode a list of colorant values into a gx_color_index_value.
*/
gx_color_index
-pdf14_encode_smask_color(gx_device *dev, const gx_color_value colors[],int ncomp)
+pdf14_encode_color(gx_device *dev, const gx_color_value colors[])
{
int drop = sizeof(gx_color_value) * 8 - 8;
gx_color_index color = 0;
int i;
+ int ncomp = dev->color_info.num_components;
for (i = 0; i < ncomp; i++) {
color <<= 8;
@@ -445,33 +436,20 @@ pdf14_encode_smask_color(gx_device *dev, const gx_color_value colors[],int ncomp
}
/*
- * Decode a gx_color_index value back to a list of colorant values.
- * This has its own decoder as it may have a different number of colorants
- * compared to the actual device.*/
-int
-pdf14_decode_smask_color(gx_device * dev, gx_color_index color, gx_color_value * out, int ncomp)
-{
- int i;
-
- for (i = 0; i < ncomp; i++) {
- out[ncomp - i - 1] = (gx_color_value) ((color & 0xff) * 0x101);
- color >>= 8;
- }
- return 0;
-}
-
-
-/*
* Encode a list of colorant values into a gx_color_index_value.
+ Stick the tag information at the end.
*/
gx_color_index
-pdf14_encode_color(gx_device *dev, const gx_color_value colors[])
+pdf14_encode_color_tag(gx_device *dev, const gx_color_value colors[])
{
int drop = sizeof(gx_color_value) * 8 - 8;
- gx_color_index color = 0;
+ gx_color_index color;
int i;
int ncomp = dev->color_info.num_components;
+ int tag_value;
+ /* Add in the tag information */
+ color = gs_current_object_tag(dev->memory);
for (i = 0; i < ncomp; i++) {
color <<= 8;
color |= (colors[i] >> drop);