summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2015-07-30 19:30:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-07-30 19:30:58 +0000
commit730c0f6591b1c99699e9d0ecf36d696f7d87629f (patch)
tree060a00f111b35e7c07cecc156e932f7c3d3df04b /libs
parent8d1d8fdaa40cc2149604c9947a7ccf1a6a494e36 (diff)
parentfa51a0e1ceb496e57f6c234800a3f5e9a2d89142 (diff)
downloadframeworks_base-730c0f6591b1c99699e9d0ecf36d696f7d87629f.zip
frameworks_base-730c0f6591b1c99699e9d0ecf36d696f7d87629f.tar.gz
frameworks_base-730c0f6591b1c99699e9d0ecf36d696f7d87629f.tar.bz2
Merge "Fix stencil mask usage in HWUI" into mnc-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/renderstate/Stencil.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/libs/hwui/renderstate/Stencil.cpp b/libs/hwui/renderstate/Stencil.cpp
index 92a057d..319cfe4 100644
--- a/libs/hwui/renderstate/Stencil.cpp
+++ b/libs/hwui/renderstate/Stencil.cpp
@@ -60,8 +60,14 @@ GLenum Stencil::getLayerStencilFormat() {
}
void Stencil::clear() {
+ glStencilMask(0xff);
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
+
+ if (mState == kTest) {
+ // reset to test state, with immutable stencil
+ glStencilMask(0);
+ }
}
void Stencil::enableTest(int incrementThreshold) {
@@ -104,17 +110,17 @@ void Stencil::enableDebugTest(GLint value, bool greater) {
// We only want to test, let's keep everything
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
mState = kTest;
+ glStencilMask(0);
}
void Stencil::enableDebugWrite() {
- if (mState != kWrite) {
- enable();
- glStencilFunc(GL_ALWAYS, 0x1, 0xffffffff);
- // The test always passes so the first two values are meaningless
- glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- mState = kWrite;
- }
+ enable();
+ glStencilFunc(GL_ALWAYS, 0x1, 0xffffffff);
+ // The test always passes so the first two values are meaningless
+ glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ mState = kWrite;
+ glStencilMask(0xff);
}
void Stencil::enable() {