summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2012-01-03 14:21:18 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2012-01-03 14:21:18 -0800
commit173ab4d61077c49f115b82eff34f97fda5a7273a (patch)
tree752fa92ed419aac3439fed2a4c141799493a881b /libs/hwui/OpenGLRenderer.cpp
parent3c673732ead2721c564c2bd46780e8ebf10e948b (diff)
parent82bc7a772747fcf8a6fe7097f70bf2981429ffe9 (diff)
Merge "Properly restore the GL scissor after a GL draw functor Bug #5781254"
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp49
1 files changed, 28 insertions, 21 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 75c6d0aebf49..d1b469f257a6 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -206,6 +206,7 @@ void OpenGLRenderer::resume() {
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glEnable(GL_SCISSOR_TEST);
+ mCaches.resetScissor();
dirtyClip();
mCaches.activeTexture(0);
@@ -2517,32 +2518,38 @@ void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode,
ProgramDescription& description, bool swapSrcDst) {
blend = blend || mode != SkXfermode::kSrcOver_Mode;
if (blend) {
- if (mode <= SkXfermode::kScreen_Mode) {
- if (!mCaches.blend) {
- glEnable(GL_BLEND);
- }
-
- GLenum sourceMode = swapSrcDst ? gBlendsSwap[mode].src : gBlends[mode].src;
- GLenum destMode = swapSrcDst ? gBlendsSwap[mode].dst : gBlends[mode].dst;
-
- if (sourceMode != mCaches.lastSrcMode || destMode != mCaches.lastDstMode) {
- glBlendFunc(sourceMode, destMode);
- mCaches.lastSrcMode = sourceMode;
- mCaches.lastDstMode = destMode;
- }
- } else {
- // These blend modes are not supported by OpenGL directly and have
- // to be implemented using shaders. Since the shader will perform
- // the blending, turn blending off here
+ // These blend modes are not supported by OpenGL directly and have
+ // to be implemented using shaders. Since the shader will perform
+ // the blending, turn blending off here
+ // If the blend mode cannot be implemented using shaders, fall
+ // back to the default SrcOver blend mode instead
+ if (mode > SkXfermode::kScreen_Mode) {
if (mCaches.extensions.hasFramebufferFetch()) {
description.framebufferMode = mode;
description.swapSrcDst = swapSrcDst;
- }
- if (mCaches.blend) {
- glDisable(GL_BLEND);
+ if (mCaches.blend) {
+ glDisable(GL_BLEND);
+ mCaches.blend = false;
+ }
+
+ return;
+ } else {
+ mode = SkXfermode::kSrcOver_Mode;
}
- blend = false;
+ }
+
+ if (!mCaches.blend) {
+ glEnable(GL_BLEND);
+ }
+
+ GLenum sourceMode = swapSrcDst ? gBlendsSwap[mode].src : gBlends[mode].src;
+ GLenum destMode = swapSrcDst ? gBlendsSwap[mode].dst : gBlends[mode].dst;
+
+ if (sourceMode != mCaches.lastSrcMode || destMode != mCaches.lastDstMode) {
+ glBlendFunc(sourceMode, destMode);
+ mCaches.lastSrcMode = sourceMode;
+ mCaches.lastDstMode = destMode;
}
} else if (mCaches.blend) {
glDisable(GL_BLEND);