summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-06-03 18:50:11 -0700
committerRomain Guy <romainguy@google.com>2011-06-03 18:51:11 -0700
commit67ffc36a79ce3a9a0b5da28b65123864b7d2597f (patch)
treec59ba66ffc9e45b58a06ab746647fa7f23f6bbd2 /libs/hwui
parentc5e626c3934d00bbfb13d48c640ba86a06aad49d (diff)
downloadframeworks_base-67ffc36a79ce3a9a0b5da28b65123864b7d2597f.zip
frameworks_base-67ffc36a79ce3a9a0b5da28b65123864b7d2597f.tar.gz
frameworks_base-67ffc36a79ce3a9a0b5da28b65123864b7d2597f.tar.bz2
Measure text with the appropriate text encoding.
Bug #4546327 Change-Id: I8eb593b03a81145e08be92579706ddd775feb0a2
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 45f4a42..8558054 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1949,7 +1949,16 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
}
if (mSnapshot->isIgnored()) return;
+ // TODO: We should probably make a copy of the paint instead of modifying
+ // it; modifying the paint will change its generationID the first
+ // time, which might impact caches. More investigation needed to
+ // see if it matters.
+ // If we make a copy, then drawTextDecorations() should *not* make
+ // its own copy as it does right now.
paint->setAntiAlias(true);
+#if RENDER_TEXT_AS_GLYPHS
+ paint->setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+#endif
float length = -1.0f;
switch (paint->getTextAlign()) {
@@ -1983,8 +1992,8 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
if (mHasShadow) {
mCaches.dropShadowCache.setFontRenderer(fontRenderer);
- const ShadowTexture* shadow = mCaches.dropShadowCache.get(paint, text, bytesCount,
- count, mShadowRadius);
+ const ShadowTexture* shadow = mCaches.dropShadowCache.get(
+ paint, text, bytesCount, count, mShadowRadius);
const AutoTexture autoCleanup(shadow);
const float sx = oldX - shadow->left + mShadowDx;
@@ -2226,10 +2235,6 @@ void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float
uint32_t flags = paint->getFlags();
if (flags & (SkPaint::kUnderlineText_Flag | SkPaint::kStrikeThruText_Flag)) {
SkPaint paintCopy(*paint);
-#if RENDER_TEXT_AS_GLYPHS
- paintCopy.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
-#endif
-
float underlineWidth = length;
// If length is > 0.0f, we already measured the text for the text alignment
if (length <= 0.0f) {