diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-07-08 10:57:14 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-07-08 10:57:14 -0700 |
commit | 45f7a371fd57f35bac0b3cdd237d9a3bd2e80958 (patch) | |
tree | 8b7d12681dd861989cf878ab0a3fda5df0b8cf42 /Source/WebCore | |
parent | bb9ba750495b335597d87dc3c103625f2bc43d94 (diff) | |
download | external_webkit-45f7a371fd57f35bac0b3cdd237d9a3bd2e80958.zip external_webkit-45f7a371fd57f35bac0b3cdd237d9a3bd2e80958.tar.gz external_webkit-45f7a371fd57f35bac0b3cdd237d9a3bd2e80958.tar.bz2 |
Add the matrix handle to the shaders.
We are just getting lucky that the handle is the same for now.
Change-Id: I8d897148dfaa29acbb2e23fd8894fcfea7f00215
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/platform/graphics/android/ShaderProgram.cpp | 10 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/ShaderProgram.h | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp index 655af0e..f9f4c4c 100644 --- a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp +++ b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp @@ -267,7 +267,7 @@ void ShaderProgram::setViewport(SkRect& viewport) m_viewport = viewport; } -void ShaderProgram::setProjectionMatrix(SkRect& geometry) +void ShaderProgram::setProjectionMatrix(SkRect& geometry, GLint projectionMatrixHandle) { TransformationMatrix translate; translate.translate3d(geometry.fLeft, geometry.fTop, 0.0); @@ -278,20 +278,21 @@ void ShaderProgram::setProjectionMatrix(SkRect& geometry) GLfloat projectionMatrix[16]; GLUtils::toGLMatrix(projectionMatrix, total); - glUniformMatrix4fv(m_hProjectionMatrix, 1, GL_FALSE, projectionMatrix); + glUniformMatrix4fv(projectionMatrixHandle, 1, GL_FALSE, projectionMatrix); } void ShaderProgram::drawQuadInternal(SkRect& geometry, GLint textureId, float opacity, GLint program, + GLint projectionMatrixHandle, GLint texSampler, GLenum textureTarget, GLint position, GLint alpha) { glUseProgram(program); - setProjectionMatrix(geometry); + setProjectionMatrix(geometry, projectionMatrixHandle); glActiveTexture(GL_TEXTURE0); glUniform1i(texSampler, 0); @@ -315,14 +316,17 @@ void ShaderProgram::drawQuad(SkRect& geometry, int textureId, float opacity, { if (textureTarget == GL_TEXTURE_2D) { drawQuadInternal(geometry, textureId, opacity, m_program, + m_hProjectionMatrix, m_hTexSampler, GL_TEXTURE_2D, m_hPosition, alpha()); } else if (textureTarget == GL_TEXTURE_EXTERNAL_OES) { drawQuadInternal(geometry, textureId, opacity, m_surfTexOESProgram, + m_hSTOESProjectionMatrix, m_hSTOESTexSampler, GL_TEXTURE_EXTERNAL_OES, m_hSTOESPosition, m_hSTOESAlpha); } else if (!textureTarget) { drawQuadInternal(geometry, textureId, opacity, m_surfTex2DProgram, + m_hST2DProjectionMatrix, m_hST2DTexSampler, GL_TEXTURE_2D, m_hST2DPosition, m_hST2DAlpha); } diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.h b/Source/WebCore/platform/graphics/android/ShaderProgram.h index 2577fb0..c64a9b9 100644 --- a/Source/WebCore/platform/graphics/android/ShaderProgram.h +++ b/Source/WebCore/platform/graphics/android/ShaderProgram.h @@ -81,12 +81,13 @@ class ShaderProgram { private: GLuint loadShader(GLenum shaderType, const char* pSource); GLuint createProgram(const char* vertexSource, const char* fragmentSource); - void setProjectionMatrix(SkRect& geometry); + void setProjectionMatrix(SkRect& geometry, GLint projectionMatrixHandle); void setBlendingState(bool enableBlending); void drawQuadInternal(SkRect& geometry, GLint textureId, float opacity, - GLint program, GLint texSampler, GLenum textureTarget, + GLint program, GLint projectionMatrixHandle, + GLint texSampler, GLenum textureTarget, GLint position, GLint alpha); void drawLayerQuadInternal(const GLfloat* projectionMatrix, int textureId, |