diff options
author | 2024-11-14 23:06:27 +0000 | |
---|---|---|
committer | 2025-01-06 13:15:49 -0800 | |
commit | 9674ffa1d161cd04b20789b4a960dfafc8cc140c (patch) | |
tree | a26dff51e5f11557d18065fed0a86c40a1162fc8 /libs/gui/LayerState.cpp | |
parent | 9bf3e87d645649bc7f29a3e46d9cad090a6d2ce2 (diff) |
surfaceflinger: Add clientDrawnCornerRadius and clientDrawnShadowLength layer properties
Modify RoundedCornerState and ShadowSettings to account for client drawn corners and shadows. When equal to the requested values, SurfaceFlinger will not draw corners and shadows for the layer.
Bug: 375624570
Flag: com.android.window.flags.ignore_corner_radius_and_shadows
Test: atest SurfaceFlinger_test; manual test - PIP, freeform window, recents, app launch
Change-Id: Idde115b51a253a34cfadfbd1ff6c7b15c44518ef
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r-- | libs/gui/LayerState.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index c1a03fcfea..44aac9bfae 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -66,6 +66,8 @@ layer_state_t::layer_state_t() mask(0), reserved(0), cornerRadius(0.0f), + clientDrawnCornerRadius(0.0f), + clientDrawnShadowRadius(0.0f), backgroundBlurRadius(0), color(0), bufferTransform(0), @@ -140,6 +142,8 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.write, colorTransform.asArray(), 16 * sizeof(float)); SAFE_PARCEL(output.writeFloat, cornerRadius); + SAFE_PARCEL(output.writeFloat, clientDrawnCornerRadius); + SAFE_PARCEL(output.writeFloat, clientDrawnShadowRadius); SAFE_PARCEL(output.writeUint32, backgroundBlurRadius); SAFE_PARCEL(output.writeParcelable, metadata); SAFE_PARCEL(output.writeFloat, bgColor.r); @@ -274,6 +278,8 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float)); SAFE_PARCEL(input.readFloat, &cornerRadius); + SAFE_PARCEL(input.readFloat, &clientDrawnCornerRadius); + SAFE_PARCEL(input.readFloat, &clientDrawnShadowRadius); SAFE_PARCEL(input.readUint32, &backgroundBlurRadius); SAFE_PARCEL(input.readParcelable, &metadata); @@ -596,6 +602,14 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eCornerRadiusChanged; cornerRadius = other.cornerRadius; } + if (other.what & eClientDrawnCornerRadiusChanged) { + what |= eClientDrawnCornerRadiusChanged; + clientDrawnCornerRadius = other.clientDrawnCornerRadius; + } + if (other.what & eClientDrawnShadowsChanged) { + what |= eClientDrawnShadowsChanged; + clientDrawnShadowRadius = other.clientDrawnShadowRadius; + } if (other.what & eBackgroundBlurRadiusChanged) { what |= eBackgroundBlurRadiusChanged; backgroundBlurRadius = other.backgroundBlurRadius; @@ -809,6 +823,8 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { } CHECK_DIFF(diff, eLayerStackChanged, other, layerStack); CHECK_DIFF(diff, eCornerRadiusChanged, other, cornerRadius); + CHECK_DIFF(diff, eClientDrawnCornerRadiusChanged, other, clientDrawnCornerRadius); + CHECK_DIFF(diff, eClientDrawnShadowsChanged, other, clientDrawnShadowRadius); CHECK_DIFF(diff, eBackgroundBlurRadiusChanged, other, backgroundBlurRadius); if (other.what & eBlurRegionsChanged) diff |= eBlurRegionsChanged; if (other.what & eRelativeLayerChanged) { |