summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2013-02-25 14:15:37 -0800
committer Romain Guy <romainguy@google.com> 2013-02-25 15:01:58 -0800
commit3ff0bfdd144bba3b023eda8c49b25fb0d0de8653 (patch)
treecfc94ccf18fb1bfaaefb1241c700900a32276acf /libs/hwui/OpenGLRenderer.cpp
parent01d159d88a51c44d7e282e07b834535e5b0e8bd1 (diff)
Add new property to debug non-rectangular clip operations
This change adds a new property called "debug.hwui.show_stencil_clip" that accepts the following values: - "highlight", colorizes in green any drawing command that's tested against a non-rectangular clip region - "region", shows the non-rectangular clip region in blue every time it is used - "hide", default value, nothing is shown Change-Id: I83c8602310edc4aaeb8b905371cdd185b17d32b5
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 1afeaf0a0444..34d1c983f87d 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1368,6 +1368,12 @@ void OpenGLRenderer::setStencilFromClip() {
drawRegionRects(*mSnapshot->clipRegion, 0xff000000, SkXfermode::kSrc_Mode, false);
mCaches.stencil.enableTest();
+
+ // Draw the region used to generate the stencil if the appropriate debug
+ // mode is enabled
+ if (mCaches.debugStencilClip == Caches::kStencilShowRegion) {
+ drawRegionRects(*mSnapshot->clipRegion, 0x7f0000ff, SkXfermode::kSrcOver_Mode);
+ }
} else {
mCaches.stencil.disable();
}
@@ -1515,12 +1521,20 @@ void OpenGLRenderer::setupDraw(bool clear) {
}
setStencilFromClip();
}
+
mDescription.reset();
+
mSetShaderColor = false;
mColorSet = false;
mColorA = mColorR = mColorG = mColorB = 0.0f;
mTextureUnit = 0;
mTrackDirtyRegions = true;
+
+ // Enable debug highlight when what we're about to draw is tested against
+ // the stencil buffer and if stencil highlight debugging is on
+ mDescription.hasDebugHighlight = !mCaches.debugOverdraw &&
+ mCaches.debugStencilClip == Caches::kStencilShowHighlight &&
+ mCaches.stencil.isTestEnabled();
}
void OpenGLRenderer::setupDrawWithTexture(bool isAlpha8) {