diff options
author | Romain Guy <romainguy@google.com> | 2013-06-18 20:08:38 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-06-18 20:08:39 +0000 |
commit | 77d55c7e5c7ace27dfe56665a59edc17102418a8 (patch) | |
tree | 36023ceec5ffdf3ce19f62a9c983767ea459d91f /libs/hwui | |
parent | ae2db13e820b68f0bf5a1c7fe933839d1723305c (diff) | |
parent | 2d5945e88731787babce1061f44cd54f02eeefc5 (diff) | |
download | frameworks_base-77d55c7e5c7ace27dfe56665a59edc17102418a8.zip frameworks_base-77d55c7e5c7ace27dfe56665a59edc17102418a8.tar.gz frameworks_base-77d55c7e5c7ace27dfe56665a59edc17102418a8.tar.bz2 |
Merge "Take hinting into account when caching fonts Bug #9464403"
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/font/Font.cpp | 5 | ||||
-rw-r--r-- | libs/hwui/font/Font.h | 1 |
2 files changed, 6 insertions, 0 deletions
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 @@ Font::FontDescription::FontDescription(const SkPaint* paint, const mat4& matrix) 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_t Font::FontDescription::hash() const { 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 @@ int Font::FontDescription::compare(const Font::FontDescription& lhs, 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] > diff --git a/libs/hwui/font/Font.h b/libs/hwui/font/Font.h index 52cca1c..9e7ec2d 100644 --- a/libs/hwui/font/Font.h +++ b/libs/hwui/font/Font.h @@ -69,6 +69,7 @@ public: uint8_t mStyle; float mStrokeWidth; bool mAntiAliasing; + uint8_t mHinting; SkMatrix mLookupTransform; SkMatrix mInverseLookupTransform; }; |