[gs-cvs] rev 8438 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Wed Dec 12 11:58:31 PST 2007
Author: leonardo
Date: 2007-12-12 11:58:31 -0800 (Wed, 12 Dec 2007)
New Revision: 8438
Modified:
trunk/gs/src/gdevp14.c
trunk/gs/src/gdevp14.h
Log:
Fix (transparency) : Unwinding the nested masks logic.
DETAILS :
The patch 8340 appears to be optimized for a particular case,
in which a call to pdf14_push_transparency_group
"will have been preceded by pdf14_push_transparency_mask ... pdf14_pop_transparency_mask".
This assumption is not true in general, when the clist interpreter
skips idle groups (either with incoming improvement or
with using the band complexity array).
This patch unwinds the change 8340 and the dependent change 8342.
It also simplifies the garbager descriptor for pdf14_buf_s.
The nested mask problem is now reopen,
but we intend to close it shortly with a different patch.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gdevp14.c
===================================================================
--- trunk/gs/src/gdevp14.c 2007-12-12 19:00:44 UTC (rev 8437)
+++ trunk/gs/src/gdevp14.c 2007-12-12 19:58:31 UTC (rev 8438)
@@ -71,30 +71,10 @@
#define PDF14_MAX_PLANES GX_DEVICE_COLOR_MAX_COMPONENTS
-/* GC procedures for buffer stack */
+gs_private_st_ptrs3(st_pdf14_buf, pdf14_buf, "pdf14_buf",
+ pdf14_buf_enum_ptrs, pdf14_buf_reloc_ptrs,
+ saved, data, transfer_fn);
-static
-ENUM_PTRS_WITH(pdf14_buf_enum_ptrs, pdf14_buf *buf)
- return 0;
- case 0: return ENUM_OBJ(buf->saved);
- case 1: return ENUM_OBJ(buf->data);
- case 2: return ENUM_OBJ(buf->transfer_fn);
- case 3: return ENUM_OBJ(buf->maskbuf);
-ENUM_PTRS_END
-
-static
-RELOC_PTRS_WITH(pdf14_buf_reloc_ptrs, pdf14_buf *buf)
-{
- RELOC_VAR(buf->saved);
- RELOC_VAR(buf->data);
- RELOC_VAR(buf->transfer_fn);
- RELOC_VAR(buf->maskbuf);
-}
-RELOC_PTRS_END
-
-gs_private_st_composite(st_pdf14_buf, pdf14_buf, "pdf14_buf",
- pdf14_buf_enum_ptrs, pdf14_buf_reloc_ptrs);
-
gs_private_st_ptrs2(st_pdf14_ctx, pdf14_ctx, "pdf14_ctx",
pdf14_ctx_enum_ptrs, pdf14_ctx_reloc_ptrs,
stack, maskbuf);
@@ -555,7 +535,6 @@
result->n_planes = n_planes;
result->rowstride = rowstride;
result->transfer_fn = NULL;
- result->maskbuf = NULL;
if (height <= 0) {
/* Empty clipping - will skip all drawings. */
@@ -586,10 +565,6 @@
static void
pdf14_buf_free(pdf14_buf *buf, gs_memory_t *memory)
{
- if (buf->maskbuf) {
- errprintf("forgot to free transparency maskbuf\n");
- pdf14_buf_free(buf->maskbuf, memory);
- }
gs_free_object(memory, buf->transfer_fn, "pdf14_buf_free");
gs_free_object(memory, buf->data, "pdf14_buf_free");
gs_free_object(memory, buf, "pdf14_buf_free");
@@ -691,14 +666,6 @@
buf->saved = tos;
ctx->stack = buf;
- /* If a transparency mask is used for this group, this function call will have
- been preceded by pdf14_push_transparency_mask ... pdf14_pop_transparency_mask
- calls to create the mask buffer. This mask is stored in ctx->maskbuf.
- We pick it up here when pushing the group (instead of when popping)
- so that nested transparency groups and masks will work. */
- buf->maskbuf = ctx->maskbuf;
- ctx->maskbuf = NULL;
-
if (buf->data == NULL)
return 0;
@@ -747,7 +714,7 @@
{
pdf14_buf *tos = ctx->stack;
pdf14_buf *nos = tos->saved;
- pdf14_buf *maskbuf = tos->maskbuf;
+ pdf14_buf *maskbuf = ctx->maskbuf;
int y0 = max(tos->rect.p.y, nos->rect.p.y);
int y1 = min(tos->rect.q.y, nos->rect.q.y);
int x0 = max(tos->rect.p.x, nos->rect.p.x);
@@ -902,11 +869,11 @@
ctx->stack = nos;
if_debug0('v', "[v]pop buf\n");
+ pdf14_buf_free(tos, ctx->memory);
if (maskbuf != NULL) {
pdf14_buf_free(maskbuf, ctx->memory);
- tos->maskbuf = NULL;
+ ctx->maskbuf = NULL;
}
- pdf14_buf_free(tos, ctx->memory);
return 0;
}
@@ -949,14 +916,7 @@
pdf14_buf *tos = ctx->stack;
ctx->stack = tos->saved;
-
- /* After creating the mask buffer we're storing it in ctx->maskbuf so
- that the next pdf14_push_transparency_group call can pick
- it up. */
- if (ctx->maskbuf != NULL)
- errprintf("programmer error. we lost a transparency mask.\n");
ctx->maskbuf = tos;
-
return 0;
}
Modified: trunk/gs/src/gdevp14.h
===================================================================
--- trunk/gs/src/gdevp14.h 2007-12-12 19:00:44 UTC (rev 8437)
+++ trunk/gs/src/gdevp14.h 2007-12-12 19:58:31 UTC (rev 8438)
@@ -52,13 +52,8 @@
int n_chan; /* number of pixel planes including alpha */
int n_planes; /* total number of planes including alpha, shape, alpha_g */
byte *data;
-
byte *transfer_fn;
-
gs_int_rect bbox;
-
- /* the associated transparency mask */
- pdf14_buf *maskbuf;
};
struct pdf14_ctx_s {
More information about the gs-cvs
mailing list