summaryrefslogtreecommitdiff
path: root/platform/java/mupdf_native.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-04-20 17:43:52 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-04-20 19:47:03 +0800
commitab4e8540dbe3d3af540a1c9c3868332c1ce519ff (patch)
tree9d880f9c756baaf590a7e1bf72c73ad60c1fcd86 /platform/java/mupdf_native.c
parente22cb5ec6696f369d45256728a5deef24ba650ff (diff)
downloadmupdf-ab4e8540dbe3d3af540a1c9c3868332c1ce519ff.tar.xz
jni: Pass independent character matrices when walking through text.
This avoids altering the matrices previously given to the Text walker.
Diffstat (limited to 'platform/java/mupdf_native.c')
-rw-r--r--platform/java/mupdf_native.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c
index 985db9ff..9921fca0 100644
--- a/platform/java/mupdf_native.c
+++ b/platform/java/mupdf_native.c
@@ -3905,10 +3905,6 @@ FUN(Text_walk)(JNIEnv *env, jobject self, jobject walker)
if (text->head == NULL)
return; /* text has no spans to walk */
- /* TODO: We reuse the same Matrix object for each call, but should we? */
- jtrm = (*env)->NewObject(env, cls_Matrix, mid_Matrix_init, 1, 0, 0, 1, 0, 0);
- if (!jtrm) return;
-
for (span = text->head; span; span = span->next)
{
if (font != span->font)
@@ -3920,23 +3916,21 @@ FUN(Text_walk)(JNIEnv *env, jobject self, jobject walker)
if (!jfont) return;
}
- (*env)->SetFloatField(env, jtrm, fid_Matrix_a, span->trm.a);
- (*env)->SetFloatField(env, jtrm, fid_Matrix_b, span->trm.b);
- (*env)->SetFloatField(env, jtrm, fid_Matrix_c, span->trm.c);
- (*env)->SetFloatField(env, jtrm, fid_Matrix_d, span->trm.d);
-
for (i = 0; i < span->len; ++i)
{
- (*env)->SetFloatField(env, jtrm, fid_Matrix_e, span->items[i].x);
- (*env)->SetFloatField(env, jtrm, fid_Matrix_f, span->items[i].y);
+ jtrm = (*env)->NewObject(env, cls_Matrix, mid_Matrix_init,
+ span->trm.a, span->trm.b, span->trm.c, span->trm.d,
+ span->items[i].x, span->items[i].y);
+ if (!jtrm) return;
(*env)->CallVoidMethod(env, walker, mid_TextWalker_showGlyph,
jfont, jtrm,
(jint)span->items[i].gid,
(jint)span->items[i].ucs,
(jint)span->wmode);
-
if ((*env)->ExceptionCheck(env)) return;
+
+ (*env)->DeleteLocalRef(env, jtrm);
}
}
}