summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2011-12-13 22:00:19 -0800
committer Romain Guy <romainguy@google.com> 2011-12-13 22:00:19 -0800
commit2d4fd364843d3efc6e6ee59ccc5beb513a86d789 (patch)
treee6314681f94a7fcd0355a5700ecf65d9e3e0c5bb /libs/hwui/OpenGLRenderer.cpp
parentec31f83bd3af1f900d1ee9116b15f56904c66dcd (diff)
Reduce the number of active texture changes
Change-Id: I94046bdfe20740c26c8183822e3002d692fde7c4
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 1f5d13b8c594..cbfd77869c5d 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1207,13 +1207,13 @@ void OpenGLRenderer::setupDrawSimpleMesh() {
void OpenGLRenderer::setupDrawTexture(GLuint texture) {
bindTexture(texture);
- glUniform1i(mCaches.currentProgram->getUniform("sampler"), mTextureUnit++);
+ mTextureUnit++;
mCaches.enableTexCoordsVertexArray();
}
void OpenGLRenderer::setupDrawExternalTexture(GLuint texture) {
bindExternalTexture(texture);
- glUniform1i(mCaches.currentProgram->getUniform("sampler"), mTextureUnit++);
+ mTextureUnit++;
mCaches.enableTexCoordsVertexArray();
}
@@ -2128,6 +2128,8 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
getAlphaAndMode(paint, &alpha, &mode);
if (mHasShadow) {
+ mCaches.activeTexture(0);
+
mCaches.dropShadowCache.setFontRenderer(fontRenderer);
const ShadowTexture* shadow = mCaches.dropShadowCache.get(
paint, text, bytesCount, count, mShadowRadius);
@@ -2142,7 +2144,6 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
shadowColor = 0xffffffff;
}
- mCaches.activeTexture(0);
setupDraw();
setupDrawWithTexture(true);
setupDrawAlpha8Color(shadowColor, shadowAlpha < 255 ? shadowAlpha : alpha);
@@ -2158,8 +2159,6 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
-
- finishDrawTexture();
}
if (paint->getAlpha() == 0 && paint->getXfermode() == NULL) {