diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-10-15 00:22:43 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-10-15 00:22:43 +0000 |
commit | 9407aa7cf0b369d31bd6c69f9c26bdf6a1f44fe9 (patch) | |
tree | 1bdcf06913988d195a69dc754c9606cb3e973595 /core/jni | |
parent | b248077a8a239fe6fe28775a7472a89ff42fdec3 (diff) | |
parent | 63aa02e47fa0fdd877b9fde7f1f6eda75b645f92 (diff) | |
download | frameworks_base-9407aa7cf0b369d31bd6c69f9c26bdf6a1f44fe9.zip frameworks_base-9407aa7cf0b369d31bd6c69f9c26bdf6a1f44fe9.tar.gz frameworks_base-9407aa7cf0b369d31bd6c69f9c26bdf6a1f44fe9.tar.bz2 |
am 63aa02e4: Merge "Load binary hyphen data files" into mnc-dr-dev
* commit '63aa02e47fa0fdd877b9fde7f1f6eda75b645f92':
Load binary hyphen data files
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_text_StaticLayout.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/core/jni/android_text_StaticLayout.cpp b/core/jni/android_text_StaticLayout.cpp index 90e4bb6..a94ea8b 100644 --- a/core/jni/android_text_StaticLayout.cpp +++ b/core/jni/android_text_StaticLayout.cpp @@ -117,9 +117,17 @@ static void nFinishBuilder(JNIEnv*, jclass, jlong nativePtr) { b->finish(); } -static jlong nLoadHyphenator(JNIEnv* env, jclass, jstring patternData) { - ScopedStringChars str(env, patternData); - Hyphenator* hyphenator = Hyphenator::load(str.get(), str.size()); +static jlong nLoadHyphenator(JNIEnv* env, jclass, jobject buffer, jint offset) { + const uint8_t* bytebuf = nullptr; + if (buffer != nullptr) { + void* rawbuf = env->GetDirectBufferAddress(buffer); + if (rawbuf != nullptr) { + bytebuf = reinterpret_cast<const uint8_t*>(rawbuf) + offset; + } else { + ALOGE("failed to get direct buffer address"); + } + } + Hyphenator* hyphenator = Hyphenator::loadBinary(bytebuf); return reinterpret_cast<jlong>(hyphenator); } @@ -177,7 +185,7 @@ static JNINativeMethod gMethods[] = { {"nNewBuilder", "()J", (void*) nNewBuilder}, {"nFreeBuilder", "(J)V", (void*) nFreeBuilder}, {"nFinishBuilder", "(J)V", (void*) nFinishBuilder}, - {"nLoadHyphenator", "(Ljava/lang/String;)J", (void*) nLoadHyphenator}, + {"nLoadHyphenator", "(Ljava/nio/ByteBuffer;I)J", (void*) nLoadHyphenator}, {"nSetLocale", "(JLjava/lang/String;J)V", (void*) nSetLocale}, {"nSetupParagraph", "(J[CIFIF[IIII)V", (void*) nSetupParagraph}, {"nSetIndents", "(J[I)V", (void*) nSetIndents}, |