summaryrefslogtreecommitdiff
path: root/android
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 /android
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 'android')
-rw-r--r--android/jni/mupdf.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c
index 277bb7b3..f0d13b73 100644
--- a/android/jni/mupdf.c
+++ b/android/jni/mupdf.c
@@ -29,7 +29,6 @@ float pageWidth = 100;
float pageHeight = 100;
fz_display_list *currentPageList;
fz_rect currentMediabox;
-int currentRotate;
fz_context *ctx;
JNIEXPORT int JNICALL
@@ -124,11 +123,8 @@ Java_com_artifex_mupdf_MuPDFCore_gotoPageInternal(JNIEnv *env, jobject thiz, int
pagenum = page;
currentPage = pdf_load_page(xref, pagenum);
zoom = resolution / 72;
- currentMediabox = currentPage->mediabox;
- currentRotate = currentPage->rotate;
- ctm = fz_translate(0, -currentMediabox.y1);
- ctm = fz_concat(ctm, fz_scale(zoom, -zoom));
- ctm = fz_concat(ctm, fz_rotate(currentRotate));
+ currentMediabox = pdf_bound_page(xref, currentPage);
+ ctm = fz_scale(zoom, zoom);
bbox = fz_round_rect(fz_transform_rect(ctm, currentMediabox));
pageWidth = bbox.x1-bbox.x0;
pageHeight = bbox.y1-bbox.y0;
@@ -216,9 +212,7 @@ Java_com_artifex_mupdf_MuPDFCore_drawPage(JNIEnv *env, jobject thiz, jobject bit
fz_clear_pixmap_with_color(pix, 0xff);
zoom = resolution / 72;
- ctm = fz_translate(-currentMediabox.x0, -currentMediabox.y1);
- ctm = fz_concat(ctm, fz_scale(zoom, -zoom));
- ctm = fz_concat(ctm, fz_rotate(currentRotate));
+ ctm = fz_scale(zoom, zoom);
bbox = fz_round_rect(fz_transform_rect(ctm,currentMediabox));
/* Now, adjust ctm so that it would give the correct page width
* heights. */