Take hinting into account when caching fonts
Bug #9464403
Change-Id: I26a5f0c17eb27d096717b444d3e18ad1d2b5a43c
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp
index 011cfc1..18983d8 100644
--- a/libs/hwui/font/Font.cpp
+++ b/libs/hwui/font/Font.cpp
@@ -55,6 +55,7 @@
mStyle = paint->getStyle();
mStrokeWidth = paint->getStrokeWidth();
mAntiAliasing = paint->isAntiAlias();
+ mHinting = paint->getHinting();
mLookupTransform.reset();
mLookupTransform[SkMatrix::kMScaleX] = roundf(fmaxf(1.0f, matrix[mat4::kScaleX]));
mLookupTransform[SkMatrix::kMScaleY] = roundf(fmaxf(1.0f, matrix[mat4::kScaleY]));
@@ -80,6 +81,7 @@
hash = JenkinsHashMix(hash, android::hash_type(mStyle));
hash = JenkinsHashMix(hash, android::hash_type(mStrokeWidth));
hash = JenkinsHashMix(hash, int(mAntiAliasing));
+ hash = JenkinsHashMix(hash, android::hash_type(mHinting));
hash = JenkinsHashMix(hash, android::hash_type(mLookupTransform[SkMatrix::kMScaleX]));
hash = JenkinsHashMix(hash, android::hash_type(mLookupTransform[SkMatrix::kMScaleY]));
return JenkinsHashWhiten(hash);
@@ -111,6 +113,9 @@
deltaInt = int(lhs.mAntiAliasing) - int(rhs.mAntiAliasing);
if (deltaInt != 0) return deltaInt;
+ deltaInt = int(lhs.mHinting) - int(rhs.mHinting);
+ if (deltaInt != 0) return deltaInt;
+
if (lhs.mLookupTransform[SkMatrix::kMScaleX] <
rhs.mLookupTransform[SkMatrix::kMScaleX]) return -1;
if (lhs.mLookupTransform[SkMatrix::kMScaleX] >