diff options
author | Romain Guy <romainguy@google.com> | 2010-07-09 16:13:28 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-07-09 16:13:28 -0700 |
commit | 16202fc9745e9b11db089ebc8f40119d13732016 (patch) | |
tree | 1765a6146b9a4fcaf9513e1b9bc851e47fdc76b3 /libs/hwui/OpenGLRenderer.cpp | |
parent | 82164ad543b4eb6c11937b2a81891443317709cc (diff) | |
download | frameworks_base-16202fc9745e9b11db089ebc8f40119d13732016.zip frameworks_base-16202fc9745e9b11db089ebc8f40119d13732016.tar.gz frameworks_base-16202fc9745e9b11db089ebc8f40119d13732016.tar.bz2 |
Fix alpha blending and improve fragment shaders performance.
Change-Id: Ib74f6941d25ca6f6a41708e541174eaa7e8d9bc2
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index e333060..6d041ae 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -469,9 +469,9 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, // Specify right and bottom as +1.0f from left/top to prevent scaling since the // patch mesh already defines the final size - drawTextureMesh(left, top, left + 1.0f, top + 1.0f, texture->id, alpha, mode, texture->blend, - true, &mesh->vertices[0].position[0], &mesh->vertices[0].texture[0], mesh->indices, - mesh->indicesCount); + drawTextureMesh(left, top, left + 1.0f, top + 1.0f, texture->id, alpha / 255.0f, mode, + texture->blend, true, &mesh->vertices[0].position[0], + &mesh->vertices[0].texture[0], mesh->indices, mesh->indicesCount); } void OpenGLRenderer::drawColor(int color, SkXfermode::Mode mode) { @@ -518,7 +518,7 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot glEnableVertexAttribArray(mDrawColorShader->position); glVertexAttribPointer(mDrawColorShader->position, 2, GL_FLOAT, GL_FALSE, gDrawColorVertexStride, p); - glVertexAttrib4f(mDrawColorShader->color, r, g, b, a); + glUniform4f(mDrawColorShader->color, r, g, b, a); glDrawArrays(GL_TRIANGLE_STRIP, 0, gDrawColorVertexCount); @@ -558,6 +558,7 @@ void OpenGLRenderer::drawTextureMesh(float left, float top, float right, float b glActiveTexture(GL_TEXTURE0); glUniform1i(mDrawTextureShader->sampler, 0); + glUniform4f(mDrawTextureShader->color, 1.0f, 1.0f, 1.0f, alpha); glEnableVertexAttribArray(mDrawTextureShader->position); glVertexAttribPointer(mDrawTextureShader->position, 2, GL_FLOAT, GL_FALSE, @@ -567,8 +568,6 @@ void OpenGLRenderer::drawTextureMesh(float left, float top, float right, float b glVertexAttribPointer(mDrawTextureShader->texCoords, 2, GL_FLOAT, GL_FALSE, gDrawTextureVertexStride, texCoords); - glVertexAttrib4f(mDrawTextureShader->color, 1.0f, 1.0f, 1.0f, alpha); - if (!indices) { glDrawArrays(GL_TRIANGLE_STRIP, 0, gDrawTextureVertexCount); } else { |