summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2011-12-05 11:53:26 -0800
committer Romain Guy <romainguy@google.com> 2011-12-05 11:53:26 -0800
commit8f9a9f61ab793d9387a5942b307e74324704893b (patch)
tree999b4e35822f96473165bf861d5c7e908f19140f /libs/hwui/OpenGLRenderer.cpp
parentcac5fd3e09e9dc918753d4aff624bf29a367ade3 (diff)
Clip text correctly
Bug #5706056 A newly introduced optimization relied on the display list renderer to properly measure text to perform fast clipping. The paint used to measure text needs to have AA and glyph id encoding set to return the correct results. Unfortunately these properties were set by the GL renderer and not by the display list renderer. This change simply sets the properties in the display list renderer instead. This change also improves the error message printed out when the application attempts to use a bitmap larger than the max texture size. Change-Id: I4d84e1c7d194aed9ad476f69434eaa2c8f3836a8
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index a60ac0804af4..81c053e3265f 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2069,16 +2069,7 @@ 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
+ // NOTE: AA and glyph id encoding are set in DisplayListRenderer.cpp
switch (paint->getTextAlign()) {
case SkPaint::kCenter_Align:
@@ -2095,6 +2086,7 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
SkPaint::FontMetrics metrics;
paint->getFontMetrics(&metrics, 0.0f);
+ // If no length was specified, just perform the hit test on the Y axis
if (quickReject(x, y + metrics.fTop,
x + (length >= 0.0f ? length : INT_MAX / 2), y + metrics.fBottom)) {
return;