Loading core/jni/android/graphics/TextLayoutCache.cpp +9 −19 Original line number Diff line number Diff line Loading @@ -338,23 +338,11 @@ uint32_t TextLayoutValue::getElapsedTime() { } TextLayoutShaper::TextLayoutShaper() { init(); mBuffer = hb_buffer_create(); } void TextLayoutShaper::init() { mDefaultTypeface = SkTypeface::CreateFromName(NULL, SkTypeface::kNormal); } void TextLayoutShaper::unrefTypefaces() { SkSafeUnref(mDefaultTypeface); } TextLayoutShaper::~TextLayoutShaper() { hb_buffer_destroy(mBuffer); unrefTypefaces(); } void TextLayoutShaper::computeValues(TextLayoutValue* value, const SkPaint* paint, const UChar* chars, Loading Loading @@ -838,24 +826,28 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint) { } if (baseGlyphCount != 0) { SkTypeface::Style style = SkTypeface::kNormal; if (typeface != NULL) { style = typeface->style(); } typeface = typefaceForScript(paint, typeface, hb_buffer_get_script(mBuffer)); if (!typeface) { baseGlyphCount = 0; typeface = mDefaultTypeface; SkSafeRef(typeface); typeface = SkTypeface::CreateFromName(NULL, style); #if DEBUG_GLYPHS ALOGD("Using Default Typeface"); #endif } } else { if (!typeface) { typeface = mDefaultTypeface; typeface = SkTypeface::CreateFromName(NULL, SkTypeface::kNormal); #if DEBUG_GLYPHS ALOGD("Using Default Typeface"); ALOGD("Using Default Typeface (normal style)"); #endif } } else { SkSafeRef(typeface); } } mShapingPaint.setTypeface(typeface); hb_face_t* face = referenceCachedHBFace(typeface); Loading Loading @@ -898,8 +890,6 @@ void TextLayoutShaper::purgeCaches() { hb_face_destroy(mCachedHBFaces.valueAt(i)); } mCachedHBFaces.clear(); unrefTypefaces(); init(); } TextLayoutEngine::TextLayoutEngine() { Loading core/jni/android/graphics/TextLayoutCache.h +0 −9 Original line number Diff line number Diff line Loading @@ -196,19 +196,11 @@ private: */ SkPaint mShapingPaint; /** * Skia default typeface to be returned if we cannot resolve script */ SkTypeface* mDefaultTypeface; /** * Cache of Harfbuzz faces */ KeyedVector<SkFontID, hb_face_t*> mCachedHBFaces; void init(); void unrefTypefaces(); SkTypeface* typefaceForScript(const SkPaint* paint, SkTypeface* typeface, hb_script_t script); Loading @@ -228,7 +220,6 @@ private: hb_face_t* referenceCachedHBFace(SkTypeface* typeface); bool isComplexScript(hb_script_t script); }; // TextLayoutShaper /** Loading Loading
core/jni/android/graphics/TextLayoutCache.cpp +9 −19 Original line number Diff line number Diff line Loading @@ -338,23 +338,11 @@ uint32_t TextLayoutValue::getElapsedTime() { } TextLayoutShaper::TextLayoutShaper() { init(); mBuffer = hb_buffer_create(); } void TextLayoutShaper::init() { mDefaultTypeface = SkTypeface::CreateFromName(NULL, SkTypeface::kNormal); } void TextLayoutShaper::unrefTypefaces() { SkSafeUnref(mDefaultTypeface); } TextLayoutShaper::~TextLayoutShaper() { hb_buffer_destroy(mBuffer); unrefTypefaces(); } void TextLayoutShaper::computeValues(TextLayoutValue* value, const SkPaint* paint, const UChar* chars, Loading Loading @@ -838,24 +826,28 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint) { } if (baseGlyphCount != 0) { SkTypeface::Style style = SkTypeface::kNormal; if (typeface != NULL) { style = typeface->style(); } typeface = typefaceForScript(paint, typeface, hb_buffer_get_script(mBuffer)); if (!typeface) { baseGlyphCount = 0; typeface = mDefaultTypeface; SkSafeRef(typeface); typeface = SkTypeface::CreateFromName(NULL, style); #if DEBUG_GLYPHS ALOGD("Using Default Typeface"); #endif } } else { if (!typeface) { typeface = mDefaultTypeface; typeface = SkTypeface::CreateFromName(NULL, SkTypeface::kNormal); #if DEBUG_GLYPHS ALOGD("Using Default Typeface"); ALOGD("Using Default Typeface (normal style)"); #endif } } else { SkSafeRef(typeface); } } mShapingPaint.setTypeface(typeface); hb_face_t* face = referenceCachedHBFace(typeface); Loading Loading @@ -898,8 +890,6 @@ void TextLayoutShaper::purgeCaches() { hb_face_destroy(mCachedHBFaces.valueAt(i)); } mCachedHBFaces.clear(); unrefTypefaces(); init(); } TextLayoutEngine::TextLayoutEngine() { Loading
core/jni/android/graphics/TextLayoutCache.h +0 −9 Original line number Diff line number Diff line Loading @@ -196,19 +196,11 @@ private: */ SkPaint mShapingPaint; /** * Skia default typeface to be returned if we cannot resolve script */ SkTypeface* mDefaultTypeface; /** * Cache of Harfbuzz faces */ KeyedVector<SkFontID, hb_face_t*> mCachedHBFaces; void init(); void unrefTypefaces(); SkTypeface* typefaceForScript(const SkPaint* paint, SkTypeface* typeface, hb_script_t script); Loading @@ -228,7 +220,6 @@ private: hb_face_t* referenceCachedHBFace(SkTypeface* typeface); bool isComplexScript(hb_script_t script); }; // TextLayoutShaper /** Loading