summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-05-22 14:32:20 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-22 14:32:20 -0700
commit5ba87a007629375bf0a2e1a45cd1954adef65338 (patch)
tree080bc3aec1e3e2aeee5c0d72b84ad26931a35ec0 /libs
parentf6f269499030cdd7fea708e01e34405906ad9a46 (diff)
parente5a4a3dc1648844f06d29efd42c9306c3cdf177e (diff)
downloadframeworks_base-5ba87a007629375bf0a2e1a45cd1954adef65338.zip
frameworks_base-5ba87a007629375bf0a2e1a45cd1954adef65338.tar.gz
frameworks_base-5ba87a007629375bf0a2e1a45cd1954adef65338.tar.bz2
am e5a4a3dc: Merge "Ensure we always set the proper blending mode Bug #6527305" into jb-dev
* commit 'e5a4a3dc1648844f06d29efd42c9306c3cdf177e': Ensure we always set the proper blending mode Bug #6527305
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp3
-rw-r--r--libs/hwui/OpenGLRenderer.cpp25
-rw-r--r--libs/hwui/OpenGLRenderer.h6
3 files changed, 24 insertions, 10 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index a5f653a..546925e 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -296,7 +296,8 @@ void DisplayList::output(OpenGLRenderer& renderer, uint32_t level) {
indent[i] = ' ';
}
indent[count] = '\0';
- ALOGD("%sStart display list (%p, %s)", (char*) indent + 2, this, mName.string());
+ ALOGD("%sStart display list (%p, %s, render=%d)", (char*) indent + 2, this,
+ mName.string(), isRenderable());
ALOGD("%s%s %d", indent, "Save", SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
int saveCount = renderer.getSaveCount() - 1;
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 766a199..2a8b32c 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -176,14 +176,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);
}
}
@@ -290,11 +302,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;
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index bf136ad..ad83b31 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -215,6 +215,12 @@ protected:
private:
/**
+ * Ensures the state of the renderer is the same as the state of
+ * the GL context.
+ */
+ void syncState();
+
+ /**
* Saves the current state of the renderer as a new snapshot.
* The new snapshot is saved in mSnapshot and the previous snapshot
* is linked from mSnapshot->previous.