Loading libs/hwui/OpenGLRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -511,7 +511,7 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot mModelView.loadTranslate(left, top, 0.0f); mModelView.scale(right - left, bottom - top, 1.0f); mDrawColorShader->use(&mOrthoMatrix[0], &mModelView.data[0], &mSnapshot->transform.data[0]); mDrawColorShader->use(&mOrthoMatrix[0], mModelView, mSnapshot->transform); const GLvoid* p = &gDrawColorVertices[0].position[0]; Loading Loading @@ -548,7 +548,7 @@ void OpenGLRenderer::drawTextureMesh(float left, float top, float right, float b mModelView.loadTranslate(left, top, 0.0f); mModelView.scale(right - left, bottom - top, 1.0f); mDrawTextureShader->use(&mOrthoMatrix[0], &mModelView.data[0], &mSnapshot->transform.data[0]); mDrawTextureShader->use(&mOrthoMatrix[0], mModelView, mSnapshot->transform); chooseBlending(blend || alpha < 1.0f, mode, isPremultiplied); Loading libs/hwui/Program.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -127,17 +127,17 @@ DrawColorProgram::DrawColorProgram(const char* vertex, const char* fragment): void DrawColorProgram::getAttribsAndUniforms() { position = addAttrib("position"); color = addUniform("color"); projection = addUniform("projection"); modelView = addUniform("modelView"); transform = addUniform("transform"); } void DrawColorProgram::use(const GLfloat* projectionMatrix, const GLfloat* modelViewMatrix, const GLfloat* transformMatrix) { void DrawColorProgram::use(const float* projectionMatrix, const mat4& modelViewMatrix, const mat4& transformMatrix) { mat4 t(projectionMatrix); t.multiply(transformMatrix); t.multiply(modelViewMatrix); Program::use(); glUniformMatrix4fv(projection, 1, GL_FALSE, projectionMatrix); glUniformMatrix4fv(modelView, 1, GL_FALSE, modelViewMatrix); glUniformMatrix4fv(transform, 1, GL_FALSE, transformMatrix); glUniformMatrix4fv(transform, 1, GL_FALSE, &t.data[0]); } /////////////////////////////////////////////////////////////////////////////// Loading libs/hwui/Program.h +13 −12 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ #include <utils/KeyedVector.h> #include <utils/RefBase.h> #include "Matrix.h" namespace android { namespace uirenderer { Loading Loading @@ -107,26 +109,18 @@ public: * Binds the program with the specified projection, modelView and * transform matrices. */ void use(const GLfloat* projectionMatrix, const GLfloat* modelViewMatrix, const GLfloat* transformMatrix); void use(const float* projectionMatrix, const mat4& modelViewMatrix, const mat4& transformMatrix); /** * Name of the position attribute. */ int position; /** * Name of the color attribute. */ int color; /** * Name of the projection uniform. */ int projection; /** * Name of the modelView uniform. * Name of the color uniform. */ int modelView; int color; /** * Name of the transform uniform. */ Loading @@ -146,7 +140,14 @@ class DrawTextureProgram: public DrawColorProgram { public: DrawTextureProgram(); /** * Name of the texture sampler uniform. */ int sampler; /** * Name of the texture coordinates attribute. */ int texCoords; }; Loading libs/hwui/shaders/drawColor.vert +1 −3 Original line number Diff line number Diff line Loading @@ -2,12 +2,10 @@ SHADER_SOURCE(gDrawColorVertexShader, attribute vec4 position; uniform mat4 projection; uniform mat4 modelView; uniform mat4 transform; void main(void) { gl_Position = projection * transform * modelView * position; gl_Position = transform * position; } ); libs/hwui/shaders/drawTexture.vert +1 −3 Original line number Diff line number Diff line Loading @@ -3,15 +3,13 @@ SHADER_SOURCE(gDrawTextureVertexShader, attribute vec4 position; attribute vec2 texCoords; uniform mat4 projection; uniform mat4 modelView; uniform mat4 transform; varying vec2 outTexCoords; void main(void) { outTexCoords = texCoords; gl_Position = projection * transform * modelView * position; gl_Position = transform * position; } ); Loading
libs/hwui/OpenGLRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -511,7 +511,7 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot mModelView.loadTranslate(left, top, 0.0f); mModelView.scale(right - left, bottom - top, 1.0f); mDrawColorShader->use(&mOrthoMatrix[0], &mModelView.data[0], &mSnapshot->transform.data[0]); mDrawColorShader->use(&mOrthoMatrix[0], mModelView, mSnapshot->transform); const GLvoid* p = &gDrawColorVertices[0].position[0]; Loading Loading @@ -548,7 +548,7 @@ void OpenGLRenderer::drawTextureMesh(float left, float top, float right, float b mModelView.loadTranslate(left, top, 0.0f); mModelView.scale(right - left, bottom - top, 1.0f); mDrawTextureShader->use(&mOrthoMatrix[0], &mModelView.data[0], &mSnapshot->transform.data[0]); mDrawTextureShader->use(&mOrthoMatrix[0], mModelView, mSnapshot->transform); chooseBlending(blend || alpha < 1.0f, mode, isPremultiplied); Loading
libs/hwui/Program.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -127,17 +127,17 @@ DrawColorProgram::DrawColorProgram(const char* vertex, const char* fragment): void DrawColorProgram::getAttribsAndUniforms() { position = addAttrib("position"); color = addUniform("color"); projection = addUniform("projection"); modelView = addUniform("modelView"); transform = addUniform("transform"); } void DrawColorProgram::use(const GLfloat* projectionMatrix, const GLfloat* modelViewMatrix, const GLfloat* transformMatrix) { void DrawColorProgram::use(const float* projectionMatrix, const mat4& modelViewMatrix, const mat4& transformMatrix) { mat4 t(projectionMatrix); t.multiply(transformMatrix); t.multiply(modelViewMatrix); Program::use(); glUniformMatrix4fv(projection, 1, GL_FALSE, projectionMatrix); glUniformMatrix4fv(modelView, 1, GL_FALSE, modelViewMatrix); glUniformMatrix4fv(transform, 1, GL_FALSE, transformMatrix); glUniformMatrix4fv(transform, 1, GL_FALSE, &t.data[0]); } /////////////////////////////////////////////////////////////////////////////// Loading
libs/hwui/Program.h +13 −12 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ #include <utils/KeyedVector.h> #include <utils/RefBase.h> #include "Matrix.h" namespace android { namespace uirenderer { Loading Loading @@ -107,26 +109,18 @@ public: * Binds the program with the specified projection, modelView and * transform matrices. */ void use(const GLfloat* projectionMatrix, const GLfloat* modelViewMatrix, const GLfloat* transformMatrix); void use(const float* projectionMatrix, const mat4& modelViewMatrix, const mat4& transformMatrix); /** * Name of the position attribute. */ int position; /** * Name of the color attribute. */ int color; /** * Name of the projection uniform. */ int projection; /** * Name of the modelView uniform. * Name of the color uniform. */ int modelView; int color; /** * Name of the transform uniform. */ Loading @@ -146,7 +140,14 @@ class DrawTextureProgram: public DrawColorProgram { public: DrawTextureProgram(); /** * Name of the texture sampler uniform. */ int sampler; /** * Name of the texture coordinates attribute. */ int texCoords; }; Loading
libs/hwui/shaders/drawColor.vert +1 −3 Original line number Diff line number Diff line Loading @@ -2,12 +2,10 @@ SHADER_SOURCE(gDrawColorVertexShader, attribute vec4 position; uniform mat4 projection; uniform mat4 modelView; uniform mat4 transform; void main(void) { gl_Position = projection * transform * modelView * position; gl_Position = transform * position; } );
libs/hwui/shaders/drawTexture.vert +1 −3 Original line number Diff line number Diff line Loading @@ -3,15 +3,13 @@ SHADER_SOURCE(gDrawTextureVertexShader, attribute vec4 position; attribute vec2 texCoords; uniform mat4 projection; uniform mat4 modelView; uniform mat4 transform; varying vec2 outTexCoords; void main(void) { outTexCoords = texCoords; gl_Position = projection * transform * modelView * position; gl_Position = transform * position; } );