From ef60fa95b2928a6d25fd588c3945ea75642896aa Mon Sep 17 00:00:00 2001 From: Victoria Lease Date: Thu, 14 Feb 2013 15:58:46 -0800 Subject: [PATCH] fix argument mismatches in Paint JNI Paint.getTextRunCursor() no longer has a "flags" argument on the Java side. The native side, however, still had the argument, and was being called with misaligned arguments, causing all manner of madcap fun. Also, the version of Paint.getTextRunCursor() that took String as an argument needed to lose the "flags" argument, as well, to prevent an infinite loop in the CharSequence version of the function, which was supposed to be calling the String version but was actually calling itself. Bug: 8201224 Change-Id: Iad0dabaf81185f29a082566cc64590f2ba9bc31c --- core/jni/android/graphics/Paint.cpp | 10 +++++----- graphics/java/android/graphics/Paint.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp index e8304923230fe..07f55e03f2d77 100644 --- a/core/jni/android/graphics/Paint.cpp +++ b/core/jni/android/graphics/Paint.cpp @@ -548,7 +548,7 @@ public: } static jint doTextRunCursor(JNIEnv *env, SkPaint* paint, const jchar *text, jint start, - jint count, jint flags, jint offset, jint opt) { + jint count, jint offset, jint opt) { jfloat scalarArray[count]; TextLayout::getTextRunAdvances(paint, text, start, count, start + count, @@ -592,19 +592,19 @@ public: } static jint getTextRunCursor___C(JNIEnv* env, jobject clazz, SkPaint* paint, jcharArray text, - jint contextStart, jint contextCount, jint flags, jint offset, jint cursorOpt) { + jint contextStart, jint contextCount, jint offset, jint cursorOpt) { jchar* textArray = env->GetCharArrayElements(text, NULL); - jint result = doTextRunCursor(env, paint, textArray, contextStart, contextCount, flags, + jint result = doTextRunCursor(env, paint, textArray, contextStart, contextCount, offset, cursorOpt); env->ReleaseCharArrayElements(text, textArray, JNI_ABORT); return result; } static jint getTextRunCursor__String(JNIEnv* env, jobject clazz, SkPaint* paint, jstring text, - jint contextStart, jint contextEnd, jint flags, jint offset, jint cursorOpt) { + jint contextStart, jint contextEnd, jint offset, jint cursorOpt) { const jchar* textArray = env->GetStringChars(text, NULL); jint result = doTextRunCursor(env, paint, textArray, contextStart, - contextEnd - contextStart, flags, offset, cursorOpt); + contextEnd - contextStart, offset, cursorOpt); env->ReleaseStringChars(text, textArray); return result; } diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index 3a83d121516ee..7d99fece6f35e 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -1849,7 +1849,7 @@ public class Paint { * @hide */ public int getTextRunCursor(String text, int contextStart, int contextEnd, - int flags, int offset, int cursorOpt) { + int offset, int cursorOpt) { if (((contextStart | contextEnd | offset | (contextEnd - contextStart) | (offset - contextStart) | (contextEnd - offset) | (text.length() - contextEnd) | cursorOpt) < 0)