diff options
author | Tor Andersson <tor@ghostscript.com> | 2011-02-08 09:08:56 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2011-02-08 09:08:56 +0000 |
commit | 96d5f06aac37d9f3149e24a9c1255bc6bf941594 (patch) | |
tree | eba31489dc70eaa2c4d949f38bdf5afb67191357 | |
parent | 1b8a2963bd93117e72d2a5159e739a77e455c37f (diff) | |
download | mupdf-96d5f06aac37d9f3149e24a9c1255bc6bf941594.tar.xz |
Don't bake annotation transform into the XObject matrix.
-rw-r--r-- | mupdf/mupdf.h | 3 | ||||
-rw-r--r-- | mupdf/pdf_annot.c | 6 | ||||
-rw-r--r-- | mupdf/pdf_build.c | 2 | ||||
-rw-r--r-- | mupdf/pdf_interpret.c | 11 |
4 files changed, 10 insertions, 12 deletions
diff --git a/mupdf/mupdf.h b/mupdf/mupdf.h index 4bbea33b..eddaa0ca 100644 --- a/mupdf/mupdf.h +++ b/mupdf/mupdf.h @@ -474,6 +474,7 @@ struct pdf_annot_s fz_obj *obj; fz_rect rect; pdf_xobject *ap; + fz_matrix matrix; pdf_annot *next; }; @@ -637,7 +638,7 @@ void pdf_showshade(pdf_csi*, fz_shade *shade); void pdf_gsave(pdf_csi *csi); void pdf_grestore(pdf_csi *csi); fz_error pdf_runcsibuffer(pdf_csi *csi, fz_obj *rdb, fz_buffer *contents); -fz_error pdf_runxobject(pdf_csi *csi, fz_obj *resources, pdf_xobject *xobj); +fz_error pdf_runxobject(pdf_csi *csi, fz_obj *resources, pdf_xobject *xobj, fz_matrix transform); fz_error pdf_runpage(pdf_xref *xref, pdf_page *page, fz_device *dev, fz_matrix ctm); fz_error pdf_runglyph(pdf_xref *xref, fz_obj *resources, fz_buffer *contents, fz_device *dev, fz_matrix ctm); diff --git a/mupdf/pdf_annot.c b/mupdf/pdf_annot.c index 2155a19e..0fa70996 100644 --- a/mupdf/pdf_annot.c +++ b/mupdf/pdf_annot.c @@ -171,17 +171,13 @@ pdf_transformannot(pdf_annot *annot) fz_rect bbox = annot->ap->bbox; fz_rect rect = annot->rect; float w, h, x, y; - fz_matrix a, aa; bbox = fz_transformrect(matrix, bbox); w = (rect.x1 - rect.x0) / (bbox.x1 - bbox.x0); h = (rect.y1 - rect.y0) / (bbox.y1 - bbox.y0); x = rect.x0 - bbox.x0; y = rect.y0 - bbox.y0; - a = fz_concat(fz_scale(w, h), fz_translate(x, y)); - aa = fz_concat(a, matrix); - - annot->ap->matrix = aa; + annot->matrix = fz_concat(fz_scale(w, h), fz_translate(x, y)); } void diff --git a/mupdf/pdf_build.c b/mupdf/pdf_build.c index 80cfa0b2..739ec976 100644 --- a/mupdf/pdf_build.c +++ b/mupdf/pdf_build.c @@ -244,7 +244,7 @@ pdf_begingroup(pdf_csi *csi, fz_rect bbox) csi->dev->beginmask(csi->dev->user, bbox, gstate->luminosity, softmask->colorspace, gstate->softmaskbc); - error = pdf_runxobject(csi, nil, softmask); + error = pdf_runxobject(csi, nil, softmask, fz_identity); if (error) fz_catch(error, "cannot run softmask"); csi->dev->endmask(csi->dev->user); diff --git a/mupdf/pdf_interpret.c b/mupdf/pdf_interpret.c index e5303042..db5fcf93 100644 --- a/mupdf/pdf_interpret.c +++ b/mupdf/pdf_interpret.c @@ -142,7 +142,7 @@ pdf_freecsi(pdf_csi *csi) } fz_error -pdf_runxobject(pdf_csi *csi, fz_obj *resources, pdf_xobject *xobj) +pdf_runxobject(pdf_csi *csi, fz_obj *resources, pdf_xobject *xobj, fz_matrix transform) { fz_error error; pdf_gstate *gstate; @@ -157,7 +157,8 @@ pdf_runxobject(pdf_csi *csi, fz_obj *resources, pdf_xobject *xobj) popmask = 0; /* apply xobject's transform matrix */ - gstate->ctm = fz_concat(xobj->matrix, gstate->ctm); + transform = fz_concat(transform, xobj->matrix); + gstate->ctm = fz_concat(transform, gstate->ctm); /* apply soft mask, create transparency group and reset state */ if (xobj->transparency) @@ -172,7 +173,7 @@ pdf_runxobject(pdf_csi *csi, fz_obj *resources, pdf_xobject *xobj) csi->dev->beginmask(csi->dev->user, bbox, gstate->luminosity, softmask->colorspace, gstate->softmaskbc); - error = pdf_runxobject(csi, resources, softmask); + error = pdf_runxobject(csi, resources, softmask, fz_identity); if (error) return fz_rethrow(error, "cannot run softmask"); csi->dev->endmask(csi->dev->user); @@ -562,7 +563,7 @@ Lsetcolorspace: if (!xobj->resources) xobj->resources = fz_keepobj(rdb); - error = pdf_runxobject(csi, rdb, xobj); + error = pdf_runxobject(csi, rdb, xobj, fz_identity); if (error) return fz_rethrow(error, "cannot draw xobject (%d %d R)", fz_tonum(obj), fz_togen(obj)); @@ -1554,7 +1555,7 @@ pdf_runpage(pdf_xref *xref, pdf_page *page, fz_device *dev, fz_matrix ctm) continue; csi = pdf_newcsi(xref, dev, ctm); - error = pdf_runxobject(csi, page->resources, annot->ap); + error = pdf_runxobject(csi, page->resources, annot->ap, annot->matrix); pdf_freecsi(csi); if (error) return fz_rethrow(error, "cannot parse annotation appearance stream"); |