summaryrefslogtreecommitdiff
path: root/android/jni
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2013-02-28 12:48:12 +0000
committerRobin Watts <robin.watts@artifex.com>2013-02-28 17:07:44 +0000
commit5d63cf651367bee808d653213c7af7a31ad833ce (patch)
tree5a61752d9b096946d27e9df5944b3119e9cc476d /android/jni
parent215550b73bfaad01b29cda005dd5b0d6b749b381 (diff)
downloadmupdf-5d63cf651367bee808d653213c7af7a31ad833ce.tar.xz
Pass bbox to pdf_set_annot_appearance rather than base on display list
Use of the bbox device to derive the area of the display list can lead to bad results because of heuristics used to handle corners of stroked paths.
Diffstat (limited to 'android/jni')
-rw-r--r--android/jni/mupdf.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c
index 26af9149..1c717f91 100644
--- a/android/jni/mupdf.c
+++ b/android/jni/mupdf.c
@@ -1427,6 +1427,7 @@ JNI_FN(MuPDFCore_addMarkupAnnotationInternal)(JNIEnv * env, jobject thiz, jobjec
{
fz_annot *annot;
fz_matrix ctm;
+ fz_rect rect = fz_empty_rect;
float zoom = glo->resolution / 72;
zoom = 1.0 / zoom;
@@ -1449,6 +1450,17 @@ JNI_FN(MuPDFCore_addMarkupAnnotationInternal)(JNIEnv * env, jobject thiz, jobjec
jobject opt = (*env)->GetObjectArrayElement(env, points, i);
pts[i].x = opt ? (*env)->GetFloatField(env, opt, x_fid) : 0.0f;
pts[i].y = opt ? (*env)->GetFloatField(env, opt, y_fid) : 0.0f;
+ fz_transform_point(&pts[i], &ctm);
+
+ if (i == 0)
+ {
+ rect.x0 = rect.x1 = pts[i].x;
+ rect.y0 = rect.y1 = pts[i].y;
+ }
+ else
+ {
+ fz_include_point_in_rect(&rect, &pts[i]);
+ }
}
annot = fz_create_annot(idoc, pc->page, type);
@@ -1477,7 +1489,7 @@ JNI_FN(MuPDFCore_addMarkupAnnotationInternal)(JNIEnv * env, jobject thiz, jobjec
if (stroke)
{
// assert(path)
- fz_stroke_path(dev, path, stroke, &ctm, fz_device_rgb, color, alpha);
+ fz_stroke_path(dev, path, stroke, &fz_identity, fz_device_rgb, color, alpha);
fz_drop_stroke_state(ctx, stroke);
stroke = NULL;
fz_free_path(ctx, path);
@@ -1495,10 +1507,10 @@ JNI_FN(MuPDFCore_addMarkupAnnotationInternal)(JNIEnv * env, jobject thiz, jobjec
if (stroke)
{
- fz_stroke_path(dev, path, stroke, &ctm, fz_device_rgb, color, alpha);
+ fz_stroke_path(dev, path, stroke, &fz_identity, fz_device_rgb, color, alpha);
}
- fz_set_annot_appearance(idoc, annot, strike_list);
+ fz_set_annot_appearance(idoc, annot, &rect, strike_list);
dump_annotation_display_lists(glo);
}
fz_always(ctx)