summaryrefslogtreecommitdiff
path: root/libs/hwui/Properties.cpp
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2023-10-24 20:43:22 -0400
committer John Reck <jreck@google.com> 2023-10-27 16:49:22 -0400
commit1b152e712159c0b82831a7567ce2f3c49cdc11bf (patch)
tree74c107d65ae11b92af840bcd985910ed7ec4dc42 /libs/hwui/Properties.cpp
parent57cca107540d12c63b10ba326483b9acc4fa7b45 (diff)
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
Diffstat (limited to 'libs/hwui/Properties.cpp')
-rw-r--r--libs/hwui/Properties.cpp24
1 files changed, 20 insertions, 4 deletions
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 <android-base/properties.h>
+#include <cutils/compiler.h>
+#include <log/log.h>
#include <algorithm>
#include <cstdlib>
#include <optional>
-#include <android-base/properties.h>
-#include <cutils/compiler.h>
-#include <log/log.h>
+#include "src/core/SkTraceEventCommon.h"
+
+#ifdef __ANDROID__
+#include <com_android_graphics_hwui_flags.h>
+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);
}