[gs-commits] mupdf/master - 0_7-13-g116cf10 - Calculate annotation appearance stream transform according to algorithm 8.1 in the spec.
Tor Andersson
tor at ghostscript.com
Wed Oct 6 16:51:12 UTC 2010
commit 116cf10b26df7a91694b19f80ab3f90ce93e82f0
Author: Tor Andersson <tor at ghostscript.com>
Date: Sun Oct 3 00:12:31 2010 +0000
Calculate annotation appearance stream transform according to algorithm 8.1 in the spec.
Ignore-this: 52eae85ac39e3b54e6520cded13feeb1
darcs-hash:20101003001231-f546f-8cb9eaa7a3338cbb1cb34c160d6a478fc147381a.gz
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/mupdf/pdf_annot.c b/mupdf/pdf_annot.c
index 0af7fa1..5c142f0 100644
--- a/mupdf/pdf_annot.c
+++ b/mupdf/pdf_annot.c
@@ -153,6 +153,26 @@ pdf_freeannot(pdf_annot *annot)
}
void
+pdf_transformannot(pdf_annot *annot)
+{
+ fz_matrix matrix = annot->ap->matrix;
+ 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;
+}
+
+void
pdf_loadannots(pdf_annot **headp, pdf_xref *xref, fz_obj *annots)
{
pdf_annot *head, *annot;
@@ -192,6 +212,9 @@ pdf_loadannots(pdf_annot **headp, pdf_xref *xref, fz_obj *annots)
annot->rect = pdf_torect(rect);
annot->ap = form;
annot->next = head;
+
+ pdf_transformannot(annot);
+
head = annot;
}
}
--
git/hooks/post-receive
More information about the gs-commits
mailing list