Deprecate Android-specific SkPaint functions.
The following functions were problematic:
const SkGlyph& getUnicharMetrics(SkUnichar, const SkMatrix*);
const SkGlyph& getGlyphMetrics(uint16_t, const SkMatrix*);
const void* findImage(const SkGlyph&, const SkMatrix*);
Replacing them with calls through SkGlyphCache solved a nasty crash
bug, so they have all been deprecated.
Bug: 11968757
Change-Id: Id746315d41aec5b211b78b172a883c2061130f08
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp
index 18983d8..3e0124c 100644
--- a/libs/hwui/font/Font.cpp
+++ b/libs/hwui/font/Font.cpp
@@ -23,6 +23,7 @@
#include <utils/Trace.h>
#include <SkGlyph.h>
+#include <SkGlyphCache.h>
#include <SkUtils.h>
#include "FontUtil.h"
@@ -271,8 +272,8 @@
if (cachedGlyph) {
// Is the glyph still in texture cache?
if (!cachedGlyph->mIsValid) {
- const SkGlyph& skiaGlyph = GET_METRICS(paint, textUnit,
- &mDescription.mLookupTransform);
+ SkAutoGlyphCache autoCache(*paint, NULL, &mDescription.mLookupTransform);
+ const SkGlyph& skiaGlyph = GET_METRICS(autoCache.getCache(), textUnit);
updateGlyphCache(paint, skiaGlyph, cachedGlyph, precaching);
}
} else {
@@ -428,8 +429,9 @@
uint32_t startY = 0;
// Get the bitmap for the glyph
+ SkAutoGlyphCache autoCache(*paint, NULL, &mDescription.mLookupTransform);
if (!skiaGlyph.fImage) {
- paint->findImage(skiaGlyph, &mDescription.mLookupTransform);
+ autoCache.getCache()->findImage(skiaGlyph);
}
mState->cacheBitmap(skiaGlyph, glyph, &startX, &startY, precaching);
@@ -463,7 +465,8 @@
CachedGlyphInfo* newGlyph = new CachedGlyphInfo();
mCachedGlyphs.add(glyph, newGlyph);
- const SkGlyph& skiaGlyph = GET_METRICS(paint, glyph, &mDescription.mLookupTransform);
+ SkAutoGlyphCache autoCache(*paint, NULL, &mDescription.mLookupTransform);
+ const SkGlyph& skiaGlyph = GET_METRICS(autoCache.getCache(), glyph);
newGlyph->mIsValid = false;
newGlyph->mGlyphIndex = skiaGlyph.fID;