From 3ff0bfdd144bba3b023eda8c49b25fb0d0de8653 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2013 14:15:37 -0800 Subject: 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 --- libs/hwui/ProgramCache.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libs/hwui/ProgramCache.cpp') diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp index 74d598d5311e..0f014cbfa96a 100644 --- a/libs/hwui/ProgramCache.cpp +++ b/libs/hwui/ProgramCache.cpp @@ -351,6 +351,8 @@ const char* gFS_Main_ApplyColorOp[4] = { // PorterDuff " fragColor = blendColors(colorBlend, fragColor);\n" }; +const char* gFS_Main_DebugHighlight = + " gl_FragColor.rgb = vec3(0.0, gl_FragColor.a, 0.0);\n"; const char* gFS_Footer = "}\n\n"; @@ -604,7 +606,8 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti // Optimization for common cases if (!description.isAA && !blendFramebuffer && !description.hasColors && - description.colorOp == ProgramDescription::kColorNone && !description.isPoint) { + description.colorOp == ProgramDescription::kColorNone && + !description.isPoint && !description.hasDebugHighlight) { bool fast = false; const bool noShader = !description.hasGradient && !description.hasBitmap; @@ -752,6 +755,9 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti if (description.hasColors) { shader.append(gFS_Main_FragColor_HasColors); } + if (description.hasDebugHighlight) { + shader.append(gFS_Main_DebugHighlight); + } } // End the shader shader.append(gFS_Footer); -- cgit v1.2.3-59-g8ed1b