diff options
author | Romain Guy <romainguy@google.com> | 2011-05-02 17:24:22 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-05-02 18:32:29 -0700 |
commit | 8f0095cd33558e9cc8a440047908e53b68906f5f (patch) | |
tree | 2f55d779bf102e0c134357d89c7de69d0444634a /libs/hwui/OpenGLRenderer.cpp | |
parent | 3a5c227279011f850036c29e7c0bc96023298d5c (diff) | |
download | frameworks_base-8f0095cd33558e9cc8a440047908e53b68906f5f.zip frameworks_base-8f0095cd33558e9cc8a440047908e53b68906f5f.tar.gz frameworks_base-8f0095cd33558e9cc8a440047908e53b68906f5f.tar.bz2 |
Allows to render with an OpenGL context inside a TextureView.
Change-Id: I59453f7fc3997f0502a1c5d325d37fed376fabc7
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 34d8fd3..71976cd 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -637,7 +637,12 @@ void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) { float alpha = layer->alpha / 255.0f; setupDraw(); - setupDrawWithExternalTexture(); + if (layer->renderTarget == GL_TEXTURE_2D) { + setupDrawWithTexture(); + } else { + setupDrawWithExternalTexture(); + } + setupDrawTextureTransform(); setupDrawColor(alpha, alpha, alpha, alpha); setupDrawColorFilter(); setupDrawBlending(layer->blend, layer->mode); @@ -645,8 +650,12 @@ void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) { setupDrawModelView(rect.left, rect.top, rect.right, rect.bottom); setupDrawPureColorUniforms(); setupDrawColorFilterUniforms(); - setupDrawExternalTexture(layer->texture); - setupDrawTextureTransform(layer->texTransform); + if (layer->renderTarget == GL_TEXTURE_2D) { + setupDrawTexture(layer->texture); + } else { + setupDrawExternalTexture(layer->texture); + } + setupDrawTextureTransformUniforms(layer->texTransform); setupDrawMesh(&mMeshVertices[0].position[0], &mMeshVertices[0].texture[0]); glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount); @@ -1095,7 +1104,11 @@ void OpenGLRenderer::setupDrawExternalTexture(GLuint texture) { glEnableVertexAttribArray(mTexCoordsSlot); } -void OpenGLRenderer::setupDrawTextureTransform(mat4& transform) { +void OpenGLRenderer::setupDrawTextureTransform() { + mDescription.hasTextureTransform = true; +} + +void OpenGLRenderer::setupDrawTextureTransformUniforms(mat4& transform) { glUniformMatrix4fv(mCaches.currentProgram->getUniform("mainTextureTransform"), 1, GL_FALSE, &transform.data[0]); } |