summaryrefslogtreecommitdiff
path: root/pdf/pdf_interpret.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-01-12 01:12:28 +0100
committerTor Andersson <tor.andersson@artifex.com>2012-01-12 01:12:28 +0100
commit9994b3f49db7bd925a7ae7874cbc99025469ee9e (patch)
treec718919738e0c70cc94959aad1b5b4997f11389f /pdf/pdf_interpret.c
parent09086b236af6e49f2f090f80a450b1d82f217f30 (diff)
downloadmupdf-9994b3f49db7bd925a7ae7874cbc99025469ee9e.tar.xz
Use the same coordinate system for pdf and xps pages in the interface.
Move coordinate space tweaks into pdf_ and xps_run_page, and provide neutral pdf_ and xps_bound_page functions to return the page size as a zero-origined bounding box.
Diffstat (limited to 'pdf/pdf_interpret.c')
-rw-r--r--pdf/pdf_interpret.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c
index c8b65dd6..fe0e1ce8 100644
--- a/pdf/pdf_interpret.c
+++ b/pdf/pdf_interpret.c
@@ -2574,10 +2574,16 @@ pdf_run_buffer(pdf_csi *csi, fz_obj *rdb, fz_buffer *contents)
void
pdf_run_page_with_usage(pdf_xref *xref, pdf_page *page, fz_device *dev, fz_matrix ctm, char *event, fz_cookie *cookie)
{
+ fz_context *ctx = dev->ctx;
pdf_csi *csi;
pdf_annot *annot;
int flags;
- fz_context *ctx = dev->ctx;
+
+ /* Adjust CTM for rotation */
+ fz_matrix page_ctm = fz_concat(fz_rotate(-page->rotate), fz_scale(1, -1));
+ fz_rect mediabox = fz_transform_rect(page_ctm, page->mediabox);
+ page_ctm = fz_concat(page_ctm, fz_translate(-mediabox.x0, -mediabox.y0));
+ ctm = fz_concat(page_ctm, ctm);
if (page->transparency)
fz_begin_group(dev, fz_transform_rect(ctm, page->mediabox), 1, 0, 0, 1);