From 59744b79ec302000802cd56d30a1bf70f0183c80 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Tue, 1 Jul 2014 17:56:52 -0700 Subject: Add hack for custom re-rasterization buckets bug:14083128 Moves all of the font transform management into OpenGLRenderer::findBestFontTransform(), and now simply passes down final rasterization transforms into the FontRenderer. Change-Id: Ie02752e6af863347b142367c7d628db5f9fc2998 --- libs/hwui/font/Font.cpp | 8 +++----- libs/hwui/font/Font.h | 6 ++++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'libs/hwui/font') diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp index a71db5b..2ea6c8c 100644 --- a/libs/hwui/font/Font.cpp +++ b/libs/hwui/font/Font.cpp @@ -45,7 +45,8 @@ Font::Font(FontRenderer* state, const Font::FontDescription& desc) : mDeviceProperties = SkDeviceProperties::Make(SkDeviceProperties::Geometry::MakeDefault(), 1.0f); } -Font::FontDescription::FontDescription(const SkPaint* paint, const mat4& matrix) { +Font::FontDescription::FontDescription(const SkPaint* paint, const SkMatrix& rasterMatrix) + : mLookupTransform(rasterMatrix) { mFontId = SkTypeface::UniqueID(paint->getTypeface()); mFontSize = paint->getTextSize(); mFlags = 0; @@ -58,9 +59,6 @@ Font::FontDescription::FontDescription(const SkPaint* paint, const mat4& matrix) 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])); if (!mLookupTransform.invert(&mInverseLookupTransform)) { ALOGW("Could not query the inverse lookup transform for this font"); } @@ -486,7 +484,7 @@ CachedGlyphInfo* Font::cacheGlyph(const SkPaint* paint, glyph_t glyph, bool prec return newGlyph; } -Font* Font::create(FontRenderer* state, const SkPaint* paint, const mat4& matrix) { +Font* Font::create(FontRenderer* state, const SkPaint* paint, const SkMatrix& matrix) { FontDescription description(paint, matrix); Font* font = state->mActiveFonts.get(description); diff --git a/libs/hwui/font/Font.h b/libs/hwui/font/Font.h index 6ddd4f2..0f10464 100644 --- a/libs/hwui/font/Font.h +++ b/libs/hwui/font/Font.h @@ -17,6 +17,8 @@ #ifndef ANDROID_HWUI_FONT_H #define ANDROID_HWUI_FONT_H +#include + #include #include @@ -50,7 +52,7 @@ public: }; struct FontDescription { - FontDescription(const SkPaint* paint, const mat4& matrix); + FontDescription(const SkPaint* paint, const SkMatrix& matrix); static int compare(const FontDescription& lhs, const FontDescription& rhs); @@ -92,7 +94,7 @@ public: /** * Creates a new font associated with the specified font state. */ - static Font* create(FontRenderer* state, const SkPaint* paint, const mat4& matrix); + static Font* create(FontRenderer* state, const SkPaint* paint, const SkMatrix& matrix); private: friend class FontRenderer; -- cgit v1.1