From 1b152e712159c0b82831a7567ce2f3c49cdc11bf Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 24 Oct 2023 20:43:22 -0400 Subject: Implement automatic SV clipping Clip SV to its ancestor clipping bounds. This enables Z-above SurfaceView + scrolling containers to work more naturally Replaces the hidden API of setEnableSurfaceClipping Fixes: 298621623 Test: Sample app Change-Id: Iaa862598e37065677f5ba163a5ac7a6fab2739ea --- libs/hwui/Properties.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'libs/hwui/Properties.cpp') diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index 5e5eb4a51b35..ad600d0bab93 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -20,15 +20,26 @@ #ifdef __ANDROID__ #include "HWUIProperties.sysprop.h" #endif -#include "src/core/SkTraceEventCommon.h" +#include +#include +#include #include #include #include -#include -#include -#include +#include "src/core/SkTraceEventCommon.h" + +#ifdef __ANDROID__ +#include +namespace hwui_flags = com::android::graphics::hwui::flags; +#else +namespace hwui_flags { +constexpr bool clip_surfaceviews() { + return false; +} +} // namespace hwui_flags +#endif namespace android { namespace uirenderer { @@ -92,6 +103,8 @@ bool Properties::isSystemOrPersistent = false; float Properties::maxHdrHeadroomOn8bit = 5.f; // TODO: Refine this number +bool Properties::clipSurfaceViews = false; + StretchEffectBehavior Properties::stretchEffectBehavior = StretchEffectBehavior::ShaderHWUI; DrawingEnabled Properties::drawingEnabled = DrawingEnabled::NotInitialized; @@ -159,6 +172,9 @@ bool Properties::load() { // call isDrawingEnabled to force loading of the property isDrawingEnabled(); + clipSurfaceViews = + base::GetBoolProperty("debug.hwui.clip_surfaceviews", hwui_flags::clip_surfaceviews()); + return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); } -- cgit v1.2.3-59-g8ed1b