From eb07af687319a0f52c219c3c0c1b73162fce9d04 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 12 Oct 2010 18:40:36 -0700 Subject: Optimize layer clears. Don't clear the entire texture when we use textures that are bigger than the layer itself. This will save time during the glClear() calls. Change-Id: I06f3259ba62affb3708ba69ea41418832c7e1a65 --- libs/hwui/OpenGLRenderer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 585fa53039bd..ffd0aed92d3e 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -425,8 +425,6 @@ bool OpenGLRenderer::createLayer(sp snapshot, float left, float top, snapshot->flags |= Snapshot::kFlagDirtyOrtho; snapshot->orthoMatrix.load(mOrthoMatrix); - setScissorFromClip(); - // Bind texture to FBO glBindFramebuffer(GL_FRAMEBUFFER, layer->fbo); glBindTexture(GL_TEXTURE_2D, layer->texture); @@ -457,10 +455,11 @@ bool OpenGLRenderer::createLayer(sp snapshot, float left, float top, #endif // Clear the FBO - glDisable(GL_SCISSOR_TEST); + glScissor(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); - glEnable(GL_SCISSOR_TEST); + + setScissorFromClip(); // Change the ortho projection glViewport(0, 0, bounds.getWidth(), bounds.getHeight()); -- cgit v1.2.3-59-g8ed1b