Add support for non-antialiased text
Change-Id: I17c073955ab94abc9b409e5fcfbc675faa07c5ba
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp
index 34afe97..128e8b8 100644
--- a/libs/hwui/font/Font.cpp
+++ b/libs/hwui/font/Font.cpp
@@ -50,6 +50,7 @@
mScaleX = paint->getTextScaleX();
mStyle = paint->getStyle();
mStrokeWidth = paint->getStrokeWidth();
+ mAntiAliasing = paint->isAntiAlias();
}
Font::~Font() {
@@ -68,6 +69,7 @@
hash = JenkinsHashMix(hash, android::hash_type(mScaleX));
hash = JenkinsHashMix(hash, android::hash_type(mStyle));
hash = JenkinsHashMix(hash, android::hash_type(mStrokeWidth));
+ hash = JenkinsHashMix(hash, int(mAntiAliasing));
return JenkinsHashWhiten(hash);
}
@@ -94,6 +96,9 @@
if (lhs.mStrokeWidth < rhs.mStrokeWidth) return -1;
if (lhs.mStrokeWidth > rhs.mStrokeWidth) return +1;
+ deltaInt = int(lhs.mAntiAliasing) - int(rhs.mAntiAliasing);
+ if (deltaInt != 0) return deltaInt;
+
return 0;
}
@@ -384,7 +389,9 @@
uint32_t startY = 0;
// Get the bitmap for the glyph
- paint->findImage(skiaGlyph, NULL);
+ if (!skiaGlyph.fImage) {
+ paint->findImage(skiaGlyph, NULL);
+ }
mState->cacheBitmap(skiaGlyph, glyph, &startX, &startY, precaching);
if (!glyph->mIsValid) {