Refactoring: Deprecate Paint.mNativeTypeface.
Bug: 64269689
Test: m checkbuild
Test: bit CtsGraphicsTestCases:*
Test: bit CtsViewTestCases:*
Test: bit CtsTextTestCases:*
Change-Id: Idc9f2b4612741be949204cd06efc41e1738d6587
diff --git a/core/jni/android_text_StaticLayout.cpp b/core/jni/android_text_StaticLayout.cpp
index ba8dec1..82a6411 100644
--- a/core/jni/android_text_StaticLayout.cpp
+++ b/core/jni/android_text_StaticLayout.cpp
@@ -160,13 +160,13 @@
}
// Basically similar to Paint.getTextRunAdvances but with C++ interface
-static jfloat nAddStyleRun(JNIEnv* env, jclass, jlong nativePtr,
- jlong nativePaint, jlong nativeTypeface, jint start, jint end, jboolean isRtl) {
+static jfloat nAddStyleRun(JNIEnv* env, jclass, jlong nativePtr, jlong nativePaint, jint start,
+ jint end, jboolean isRtl) {
minikin::LineBreaker* b = reinterpret_cast<minikin::LineBreaker*>(nativePtr);
Paint* paint = reinterpret_cast<Paint*>(nativePaint);
- Typeface* typeface = reinterpret_cast<Typeface*>(nativeTypeface);
+ const Typeface* typeface = paint->getAndroidTypeface();
minikin::MinikinPaint minikinPaint;
- Typeface* resolvedTypeface = Typeface::resolveDefault(typeface);
+ const Typeface* resolvedTypeface = Typeface::resolveDefault(typeface);
minikin::FontStyle style = MinikinUtils::prepareMinikinPaint(&minikinPaint, paint,
typeface);
return b->addStyleRun(&minikinPaint, resolvedTypeface->fFontCollection, style, start, end,
@@ -201,7 +201,7 @@
{"nSetLocales", "(JLjava/lang/String;[J)V", (void*) nSetLocales},
{"nSetupParagraph", "(J[CIFIF[IIIIZ)V", (void*) nSetupParagraph},
{"nSetIndents", "(J[I)V", (void*) nSetIndents},
- {"nAddStyleRun", "(JJJIIZ)F", (void*) nAddStyleRun},
+ {"nAddStyleRun", "(JJIIZ)F", (void*) nAddStyleRun},
{"nAddMeasuredRun", "(JII[F)V", (void*) nAddMeasuredRun},
{"nAddReplacementRun", "(JIIF)V", (void*) nAddReplacementRun},
{"nGetWidths", "(J[F)V", (void*) nGetWidths},