SurfaceFlinger: Don't render rounded corners without a valid crop
A behaviour difference introduced by I6975332392756d3d96fed1d6f81245a9c7bf0a19
This will cause layers to not render if there is a corner radius
left behind.
Test: SurfaceFlinger_test
Test: repro steps in bug
Bug: 200781179
Change-Id: Ie2548fc37bb7676c10be69130d04f93e7323e79b
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 90273e4..f559ed0 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1939,8 +1939,9 @@
Rect layerCropRect = getCroppedBufferSize(getDrawingState());
const float radius = getDrawingState().cornerRadius;
RoundedCornerState layerSettings(layerCropRect.toFloatRect(), radius);
+ const bool layerSettingsValid = layerSettings.radius > 0 && layerCropRect.isValid();
- if (layerSettings.radius > 0 && parentSettings.radius > 0) {
+ if (layerSettingsValid && parentSettings.radius > 0) {
// If the parent and the layer have rounded corner settings, use the parent settings if the
// parent crop is entirely inside the layer crop.
// This has limitations and cause rendering artifacts. See b/200300845 for correct fix.
@@ -1952,7 +1953,7 @@
} else {
return layerSettings;
}
- } else if (layerSettings.radius > 0) {
+ } else if (layerSettingsValid) {
return layerSettings;
} else if (parentSettings.radius > 0) {
return parentSettings;