diff options
Diffstat (limited to 'libs/hwui/Stencil.cpp')
-rw-r--r-- | libs/hwui/Stencil.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libs/hwui/Stencil.cpp b/libs/hwui/Stencil.cpp index 9d2c86f..84df82b 100644 --- a/libs/hwui/Stencil.cpp +++ b/libs/hwui/Stencil.cpp @@ -37,9 +37,10 @@ void Stencil::clear() { void Stencil::enableTest() { if (mState != kTest) { enable(); - glStencilFunc(GL_LESS, 0x0, 0x1); + glStencilFunc(GL_EQUAL, 0x1, 0x1); // We only want to test, let's keep everything glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); mState = kTest; } } @@ -50,12 +51,32 @@ void Stencil::enableWrite() { glStencilFunc(GL_ALWAYS, 0x1, 0x1); // The test always passes so the first two values are meaningless glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + mState = kWrite; + } +} + +void Stencil::enableDebugTest(GLint value, bool greater) { + enable(); + glStencilFunc(greater ? GL_LESS : GL_EQUAL, value, 0xffffffff); + // We only want to test, let's keep everything + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + mState = kTest; +} + +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; } } void Stencil::enable() { - if (!mState == kDisabled) { + if (mState == kDisabled) { glEnable(GL_STENCIL_TEST); } } |