diff options
author | Romain Guy <romainguy@google.com> | 2011-03-02 14:04:47 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-02 14:04:47 -0800 |
commit | 4677c5118c29b5621ababc136b749f02a3d543d6 (patch) | |
tree | 9c40946c2ddb9e8b4424a65d4be8eb2b582a1709 /libs | |
parent | d08f27ee5b0bd6dee4942bbefd02dc4add09d742 (diff) | |
parent | 8668f8a633d9299091556c3b2e5ae07be8dce360 (diff) | |
download | frameworks_base-4677c5118c29b5621ababc136b749f02a3d543d6.zip frameworks_base-4677c5118c29b5621ababc136b749f02a3d543d6.tar.gz frameworks_base-4677c5118c29b5621ababc136b749f02a3d543d6.tar.bz2 |
Merge "Fix problem with glyph cache and textScaleX property"
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/FontRenderer.cpp | 15 | ||||
-rw-r--r-- | libs/hwui/FontRenderer.h | 6 |
2 files changed, 13 insertions, 8 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index 8bae684..aa9b40e 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -40,9 +40,9 @@ namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// Font::Font(FontRenderer* state, uint32_t fontId, float fontSize, - int flags, uint32_t italicStyle) : + int flags, uint32_t italicStyle, uint32_t scaleX) : mState(state), mFontId(fontId), mFontSize(fontSize), - mFlags(flags), mItalicStyle(italicStyle) { + mFlags(flags), mItalicStyle(italicStyle), mScaleX(scaleX) { } @@ -279,18 +279,19 @@ Font::CachedGlyphInfo* Font::cacheGlyph(SkPaint* paint, int32_t glyph) { } Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize, - int flags, uint32_t italicStyle) { + int flags, uint32_t italicStyle, uint32_t scaleX) { Vector<Font*> &activeFonts = state->mActiveFonts; for (uint32_t i = 0; i < activeFonts.size(); i++) { Font* font = activeFonts[i]; if (font->mFontId == fontId && font->mFontSize == fontSize && - font->mFlags == flags && font->mItalicStyle == italicStyle) { + font->mFlags == flags && font->mItalicStyle == italicStyle && + font->mScaleX == scaleX) { return font; } } - Font* newFont = new Font(state, fontId, fontSize, flags, italicStyle); + Font* newFont = new Font(state, fontId, fontSize, flags, italicStyle, scaleX); activeFonts.push(newFont); return newFont; } @@ -657,7 +658,9 @@ void FontRenderer::setFont(SkPaint* paint, uint32_t fontId, float fontSize) { const float skewX = paint->getTextSkewX(); uint32_t italicStyle = *(uint32_t*) &skewX; - mCurrentFont = Font::create(this, fontId, fontSize, flags, italicStyle); + const float scaleXFloat = paint->getTextScaleX(); + uint32_t scaleX = *(uint32_t*) &scaleXFloat; + mCurrentFont = Font::create(this, fontId, fontSize, flags, italicStyle, scaleX); const float maxPrecacheFontSize = 40.0f; bool isNewFont = currentNumFonts != mActiveFonts.size(); diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h index 46f332e..3a7aa96 100644 --- a/libs/hwui/FontRenderer.h +++ b/libs/hwui/FontRenderer.h @@ -58,7 +58,7 @@ public: * Creates a new font associated with the specified font state. */ static Font* create(FontRenderer* state, uint32_t fontId, float fontSize, - int flags, uint32_t italicStyle); + int flags, uint32_t italicStyle, uint32_t scaleX); protected: friend class FontRenderer; @@ -104,7 +104,8 @@ protected: SkFixed mRsbDelta; }; - Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags, uint32_t italicStyle); + Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags, uint32_t italicStyle, + uint32_t scaleX); DefaultKeyedVector<int32_t, CachedGlyphInfo*> mCachedGlyphs; @@ -124,6 +125,7 @@ protected: float mFontSize; int mFlags; uint32_t mItalicStyle; + uint32_t mScaleX; }; class FontRenderer { |