From 48c7edd1961e2dbb3aaff05618b701001f879c31 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 15 Jul 2010 20:38:23 +0000 Subject: Check page for transparency to install a page-level transparency group. --- fitz/dev_draw.c | 23 ++++++++++++----------- fitz/dev_list.c | 9 +++++---- fitz/dev_null.c | 2 +- fitz/dev_trace.c | 2 +- fitz/fitz.h | 6 +++--- fitz/res_font.c | 6 +++--- 6 files changed, 25 insertions(+), 23 deletions(-) (limited to 'fitz') diff --git a/fitz/dev_draw.c b/fitz/dev_draw.c index 86ef1846..28550174 100644 --- a/fitz/dev_draw.c +++ b/fitz/dev_draw.c @@ -24,8 +24,10 @@ struct fz_drawdevice_s } clipstack[MAXCLIP]; int cliptop; - fz_blendmode blendmode; - fz_pixmap *groupstack[MAXCLIP]; + struct { + fz_pixmap *dest; + fz_blendmode blendmode; + } groupstack[MAXCLIP]; int grouptop; }; @@ -819,14 +821,12 @@ fz_drawendmask(void *user) } static void -fz_drawbegingroup(void *user, fz_rect rect, fz_colorspace *colorspace, int isolated, int knockout, fz_blendmode blendmode) +fz_drawbegingroup(void *user, fz_rect rect, int isolated, int knockout, fz_blendmode blendmode) { fz_drawdevice *dev = user; fz_bbox bbox; fz_pixmap *dest; - fz_warn("fz_drawbegingroup"); - if (dev->cliptop == MAXCLIP) { fz_warn("assert: too many clip masks on stack"); @@ -839,8 +839,9 @@ fz_drawbegingroup(void *user, fz_rect rect, fz_colorspace *colorspace, int isola fz_clearpixmap(dest, 0); - dev->blendmode = blendmode; - dev->groupstack[dev->grouptop++] = dev->dest; + dev->groupstack[dev->grouptop].blendmode = blendmode; + dev->groupstack[dev->grouptop].dest = dev->dest; + dev->grouptop++; dev->dest = dest; } @@ -849,14 +850,14 @@ fz_drawendgroup(void *user) { fz_drawdevice *dev = user; fz_pixmap *group = dev->dest; - - fz_warn("fz_drawendgroup"); + fz_blendmode blendmode; if (dev->grouptop > 0) { dev->grouptop--; - dev->dest = dev->groupstack[dev->grouptop]; - fz_blendpixmaps(group, dev->dest, dev->blendmode); + dev->dest = dev->groupstack[dev->grouptop].dest; + blendmode = dev->groupstack[dev->grouptop].blendmode; + fz_blendpixmaps(group, dev->dest, blendmode); } fz_droppixmap(group); diff --git a/fitz/dev_list.c b/fitz/dev_list.c index f3e7c750..c5c65017 100644 --- a/fitz/dev_list.c +++ b/fitz/dev_list.c @@ -269,10 +269,10 @@ fz_listendmask(void *user) } static void -fz_listbegingroup(void *user, fz_rect rect, fz_colorspace *colorspace, int isolated, int knockout, fz_blendmode blendmode) +fz_listbegingroup(void *user, fz_rect rect, int isolated, int knockout, fz_blendmode blendmode) { fz_displaynode *node; - node = fz_newdisplaynode(FZ_CMDBEGINGROUP, fz_identity, colorspace, nil, 0); + node = fz_newdisplaynode(FZ_CMDBEGINGROUP, fz_identity, nil, nil, 0); node->rect = rect; node->item.blendmode = blendmode; node->flag |= isolated ? ISOLATED : 0; @@ -406,8 +406,9 @@ fz_executedisplaylist(fz_displaylist *list, fz_device *dev, fz_matrix topctm) break; case FZ_CMDBEGINGROUP: bbox = fz_transformrect(topctm, node->rect); - dev->begingroup(dev->user, bbox, node->colorspace, - node->flag & ISOLATED, node->flag & KNOCKOUT, node->item.blendmode); + dev->begingroup(dev->user, bbox, + node->flag & ISOLATED, node->flag & KNOCKOUT, + node->item.blendmode); break; case FZ_CMDENDGROUP: dev->endgroup(dev->user); diff --git a/fitz/dev_null.c b/fitz/dev_null.c index 223275aa..90737e63 100644 --- a/fitz/dev_null.c +++ b/fitz/dev_null.c @@ -17,7 +17,7 @@ static void fz_nullfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm, fz static void fz_nullclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm) {} static void fz_nullbeginmask(void *user, fz_rect r, int luminosity, fz_colorspace *cs, float *bc) {} static void fz_nullendmask(void *user) {} -static void fz_nullbegingroup(void *user, fz_rect r, fz_colorspace *cs, int isolated, int knockout, fz_blendmode blendmode) {} +static void fz_nullbegingroup(void *user, fz_rect r, int isolated, int knockout, fz_blendmode blendmode) {} static void fz_nullendgroup(void *user) {} fz_device * diff --git a/fitz/dev_trace.c b/fitz/dev_trace.c index b51015f8..6941ec40 100644 --- a/fitz/dev_trace.c +++ b/fitz/dev_trace.c @@ -244,7 +244,7 @@ fz_traceendmask(void *user) } static void -fz_tracebegingroup(void *user, fz_rect bbox, fz_colorspace *colorspace, int isolated, int knockout, fz_blendmode blendmode) +fz_tracebegingroup(void *user, fz_rect bbox, int isolated, int knockout, fz_blendmode blendmode) { printf("\n", bbox.x0, bbox.y0, bbox.x1, bbox.y1, diff --git a/fitz/fitz.h b/fitz/fitz.h index e8fb9efe..38b26619 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -759,8 +759,8 @@ struct fz_font_s fz_buffer **t3procs; /* has 256 entries if used */ float *t3widths; /* has 256 entries if used */ void *t3xref; /* a pdf_xref for the callback */ - fz_error (*t3runcontentstream)(struct fz_device_s *dev, fz_matrix ctm, - struct pdf_xref_s *xref, fz_obj *resources, fz_buffer *contents); + fz_error (*t3run)(struct pdf_xref_s *xref, fz_obj *resources, fz_buffer *contents, + struct fz_device_s *dev, fz_matrix ctm); fz_rect bbox; @@ -1016,7 +1016,7 @@ struct fz_device_s void (*beginmask)(void *, fz_rect, int luminosity, fz_colorspace *cs, float *bc); void (*endmask)(void *); - void (*begingroup)(void *, fz_rect, fz_colorspace *, int isolated, int knockout, fz_blendmode blendmode); + void (*begingroup)(void *, fz_rect, int isolated, int knockout, fz_blendmode blendmode); void (*endgroup)(void *); }; diff --git a/fitz/res_font.c b/fitz/res_font.c index aca58c0b..368c4919 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -24,7 +24,7 @@ fz_newfont(void) font->t3procs = nil; font->t3widths = nil; font->t3xref = nil; - font->t3runcontentstream = nil; + font->t3run = nil; font->bbox.x0 = 0; font->bbox.y0 = 0; @@ -466,7 +466,7 @@ fz_rendert3glyph(fz_font *font, int gid, fz_matrix trm) ctm = fz_concat(font->t3matrix, trm); dev = fz_newbboxdevice(&bbox); - error = font->t3runcontentstream(dev, ctm, font->t3xref, font->t3resources, contents); + error = font->t3run(font->t3xref, font->t3resources, contents, dev, ctm); if (error) fz_catch(error, "cannot draw type3 glyph"); fz_freedevice(dev); @@ -476,7 +476,7 @@ fz_rendert3glyph(fz_font *font, int gid, fz_matrix trm) cache = fz_newglyphcache(); dev = fz_newdrawdevice(cache, glyph); - error = font->t3runcontentstream(dev, ctm, font->t3xref, font->t3resources, contents); + error = font->t3run(font->t3xref, font->t3resources, contents, dev, ctm); if (error) fz_catch(error, "cannot draw type3 glyph"); fz_freedevice(dev); -- cgit v1.2.3