summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
diff options
context:
space:
mode:
authorStan Iliev <stani@google.com>2018-05-24 10:36:40 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-05-24 10:36:40 -0700
commit511216f030eb311a6dfc6ac65ebe58fa8d900807 (patch)
treefc6f5bd3d958e649c8d3402e9bcc0025187db081 /libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
parenta41a7094ac17ae3e88e3cb0757a30548bcbcc40f (diff)
parent8deb6ac7cd81db578b0bff0fc948030cf9041aa1 (diff)
Merge "Make sure frame buffer 0 is bound before calling GL functor" into pi-dev am: a2cc38e7fb
am: 8deb6ac7cd Change-Id: Icc245a07ca723cce71263002a2e613f7c52f227d
Diffstat (limited to 'libs/hwui/pipeline/skia/GLFunctorDrawable.cpp')
-rw-r--r--libs/hwui/pipeline/skia/GLFunctorDrawable.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
index 7b69b633a91a..08f8da89758e 100644
--- a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
+++ b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
@@ -77,13 +77,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);
@@ -94,11 +101,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());