diff options
author | Stan Iliev <stani@google.com> | 2018-05-23 15:29:09 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2018-05-23 15:29:09 -0400 |
commit | 357c63d1e9906492ac2cf5341a77d3550d0dd474 (patch) | |
tree | 0dbaa936c83e50e72dc005fd70999335898d330d /libs/hwui/pipeline/skia/GLFunctorDrawable.cpp | |
parent | 6555a9fa16d4eb53872b8d1f5876166c81641203 (diff) |
Make sure frame buffer 0 is bound before calling GL functor
Make sure view port and frame buffer are set to the correct values
before calling GL functor (WebView) draw.
Improve correctness for stencil clip by doing a second flush that
guarantees the stencil clear will be executed after draw commands.
Bug: 79619253
Test: XFINITY Connect app draws correctly
Change-Id: Ieb3d0d70caf0469b6393e6287f8529cd86519301
Diffstat (limited to 'libs/hwui/pipeline/skia/GLFunctorDrawable.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/GLFunctorDrawable.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp index 145e3c485cbc..9c80ff86df53 100644 --- a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp +++ b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp @@ -76,13 +76,20 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { // apply a simple clip with a scissor or a complex clip with a stencil SkRegion clipRegion; canvas->temporary_internal_getRgnClip(&clipRegion); + canvas->flush(); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glViewport(0, 0, info.width, info.height); if (CC_UNLIKELY(clipRegion.isComplex())) { + //TODO: move stencil clear and canvas flush to SkAndroidFrameworkUtils::clipWithStencil glDisable(GL_SCISSOR_TEST); glStencilMask(0x1); glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); + // GL ops get inserted here if previous flush is missing, which could dirty the stencil bool stencilWritten = SkAndroidFrameworkUtils::clipWithStencil(canvas); - canvas->flush(); + canvas->flush(); //need this flush for the single op that draws into the stencil + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glViewport(0, 0, info.width, info.height); if (stencilWritten) { glStencilMask(0x1); glStencilFunc(GL_EQUAL, 0x1, 0x1); @@ -93,11 +100,9 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { glDisable(GL_STENCIL_TEST); } } else if (clipRegion.isEmpty()) { - canvas->flush(); glDisable(GL_STENCIL_TEST); glDisable(GL_SCISSOR_TEST); } else { - canvas->flush(); glDisable(GL_STENCIL_TEST); glEnable(GL_SCISSOR_TEST); setScissor(info.height, clipRegion.getBounds()); |