Fix text rendering artifact.
Change-Id: I50f47207846e4208d363dde4e8f5f1a0f23d2d75
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 0a95408..97bb73f 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -865,6 +865,10 @@
fontRenderer.setFont(paint, SkTypeface::UniqueID(paint->getTypeface()),
paint->getTextSize());
+ Rect clipRect(*mSnapshot->clipRect);
+ glScissor(clipRect.left, mSnapshot->height - clipRect.bottom,
+ clipRect.getWidth(), clipRect.getHeight());
+
if (mHasShadow) {
glActiveTexture(gTextureUnits[0]);
mCaches.dropShadowCache.setFontRenderer(fontRenderer);
@@ -889,12 +893,15 @@
const Rect& clip = mSnapshot->getLocalClip();
clearLayerRegions();
+
fontRenderer.renderText(paint, &clip, text, 0, bytesCount, count, x, y);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(mCaches.currentProgram->getAttrib("texCoords"));
drawTextDecorations(text, bytesCount, length, x, y, paint);
+
+ setScissorFromClip();
}
void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) {