Loading libs/hwui/OpenGLRenderer.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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); Loading Loading @@ -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, Loading @@ -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 { Loading libs/hwui/Program.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ DrawColorProgram::DrawColorProgram(const char* vertex, const char* fragment): void DrawColorProgram::getAttribsAndUniforms() { position = addAttrib("position"); color = addAttrib("color"); color = addUniform("color"); projection = addUniform("projection"); modelView = addUniform("modelView"); transform = addUniform("transform"); Loading libs/hwui/shaders/drawColor.frag +2 −2 Original line number Diff line number Diff line SHADER_SOURCE(gDrawColorFragmentShader, varying lowp vec4 outColor; uniform vec4 color; void main(void) { gl_FragColor = outColor; gl_FragColor = color; } ); libs/hwui/shaders/drawColor.vert +0 −4 Original line number Diff line number Diff line SHADER_SOURCE(gDrawColorVertexShader, attribute vec4 position; attribute vec4 color; uniform mat4 projection; uniform mat4 modelView; uniform mat4 transform; varying vec4 outColor; void main(void) { outColor = color; gl_Position = projection * transform * modelView * position; } Loading libs/hwui/shaders/drawTexture.frag +2 −2 Original line number Diff line number Diff line SHADER_SOURCE(gDrawTextureFragmentShader, varying lowp vec4 outColor; varying mediump vec2 outTexCoords; uniform vec4 color; uniform sampler2D sampler; void main(void) { gl_FragColor = texture2D(sampler, outTexCoords) * outColor; gl_FragColor = texture2D(sampler, outTexCoords) * color; } ); Loading
libs/hwui/OpenGLRenderer.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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); Loading Loading @@ -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, Loading @@ -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 { Loading
libs/hwui/Program.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ DrawColorProgram::DrawColorProgram(const char* vertex, const char* fragment): void DrawColorProgram::getAttribsAndUniforms() { position = addAttrib("position"); color = addAttrib("color"); color = addUniform("color"); projection = addUniform("projection"); modelView = addUniform("modelView"); transform = addUniform("transform"); Loading
libs/hwui/shaders/drawColor.frag +2 −2 Original line number Diff line number Diff line SHADER_SOURCE(gDrawColorFragmentShader, varying lowp vec4 outColor; uniform vec4 color; void main(void) { gl_FragColor = outColor; gl_FragColor = color; } );
libs/hwui/shaders/drawColor.vert +0 −4 Original line number Diff line number Diff line SHADER_SOURCE(gDrawColorVertexShader, attribute vec4 position; attribute vec4 color; uniform mat4 projection; uniform mat4 modelView; uniform mat4 transform; varying vec4 outColor; void main(void) { outColor = color; gl_Position = projection * transform * modelView * position; } Loading
libs/hwui/shaders/drawTexture.frag +2 −2 Original line number Diff line number Diff line SHADER_SOURCE(gDrawTextureFragmentShader, varying lowp vec4 outColor; varying mediump vec2 outTexCoords; uniform vec4 color; uniform sampler2D sampler; void main(void) { gl_FragColor = texture2D(sampler, outTexCoords) * outColor; gl_FragColor = texture2D(sampler, outTexCoords) * color; } );