[RoundedCorners] Avoid using invalid crop.
BUG: 125916918
Test: Verify with Youtube, Photos, Chrome and Camera.
Change-Id: I7d85ec2d9861a60ed8b1cc0c853107d6bef8a552
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 1142df8..b358437 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1804,8 +1804,9 @@
}
}
const float radius = getDrawingState().cornerRadius;
- return radius > 0 ? RoundedCornerState(getCrop(getDrawingState()).toFloatRect(), radius)
- : RoundedCornerState();
+ return radius > 0 && getCrop(getDrawingState()).isValid()
+ ? RoundedCornerState(getCrop(getDrawingState()).toFloatRect(), radius)
+ : RoundedCornerState();
}
void Layer::commitChildList() {