Enable partial invalidates when rendering with OpenGL.
Change-Id: Ie8be06c4776b815e8737753eb8003b4fd8936130
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 98f8fc5..d343a6f 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -136,6 +136,10 @@
}
void OpenGLRenderer::prepare(bool opaque) {
+ prepareDirty(0.0f, 0.0f, mWidth, mHeight, opaque);
+}
+
+void OpenGLRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) {
mCaches.clearGarbage();
mSnapshot = new Snapshot(mFirstSnapshot,
@@ -146,15 +150,14 @@
glDisable(GL_DITHER);
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(left, mSnapshot->height - bottom, right - left, bottom - top);
+ mSnapshot->setClip(left, top, right, bottom);
+
if (!opaque) {
- glDisable(GL_SCISSOR_TEST);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
}
-
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, 0, mWidth, mHeight);
- mSnapshot->setClip(0.0f, 0.0f, mWidth, mHeight);
}
void OpenGLRenderer::finish() {