diff options
author | Romain Guy <romainguy@google.com> | 2012-05-22 14:07:07 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-05-22 14:08:10 -0700 |
commit | ddf74373616c89e0880a28a2185fd7ce3db91de6 (patch) | |
tree | dab9856ef8a857b0b107c2f471b089605a6c73b1 /libs/hwui/OpenGLRenderer.cpp | |
parent | 51f7c6b3620549429cd6c62e38bace43085e04fb (diff) | |
download | frameworks_base-ddf74373616c89e0880a28a2185fd7ce3db91de6.zip frameworks_base-ddf74373616c89e0880a28a2185fd7ce3db91de6.tar.gz frameworks_base-ddf74373616c89e0880a28a2185fd7ce3db91de6.tar.bz2 |
Ensure we always set the proper blending mode
Bug #6527305
At the beginning of a frame, always set the blending mode that we
think GL is using just in case it was modified by another entity
(for instance a WebView functor.)
Change-Id: I0e1d0abee8a2abb2b8e7622aed28346e89562c06
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 50f5d57..fa3780d 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -177,14 +177,26 @@ void OpenGLRenderer::prepareDirty(float left, float top, float right, float bott mSnapshot->fbo = getTargetFbo(); mSaveCount = 1; - glViewport(0, 0, mWidth, mHeight); - mCaches.setScissor(left, mSnapshot->height - bottom, right - left, bottom - top); - mSnapshot->setClip(left, top, right, bottom); - mDirtyClip = false; + mDirtyClip = opaque; + + syncState(); if (!opaque) { + mCaches.setScissor(left, mSnapshot->height - bottom, right - left, bottom - top); glClear(GL_COLOR_BUFFER_BIT); + } else { + mCaches.resetScissor(); + } +} + +void OpenGLRenderer::syncState() { + glViewport(0, 0, mWidth, mHeight); + + if (mCaches.blend) { + glEnable(GL_BLEND); + } else { + glDisable(GL_BLEND); } } @@ -291,11 +303,6 @@ status_t OpenGLRenderer::invokeFunctors(Rect& dirty) { } } - // Restore state possibly changed by the functors in process mode - GLboolean value; - glGetBooleanv(GL_BLEND, &value); - mCaches.blend = value; - mCaches.activeTexture(0); return result; |