Fix ClipDrawTest

Because Outline clip requirements
have been relaxed, path outlines
can now be used for outline clips.
As a result, compose's graphicsLayer
no longer falls back into the manual
clipping behavior which does a full
invalidation + redraw of the layer. Instead
the layer is updated without re-recording
drawing commands. This means that
draw modifiers will not be re-invoked
if a change in graphicsLayer shape is
made. To take this into account, we
move the CountdownLatch#countDown call from the
draw callback to the graphics layer block
to ensure that we no longer run into timeouts
waiting to verify the screenshot result.

Additionally introduce some variance in pixel
sampling coordinates to account for non-deterministic
anti-aliasing behavior.

Fixes: 213947480
Test: Updated ClipDrawTest
Change-Id: I8fe25274e5a022564e8b8893399ea0db4e12a6f9
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt
index 7195ed1..350e13c 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt
@@ -404,12 +404,12 @@
                 topLeft = Offset(-100f, -100f),
                 size = Size(size.width + 200f, size.height + 200f)
             )
-            drawLatch.countDown()
         }
 
         val clip = Modifier.graphicsLayer {
             shape = model.value
             clip = true
+            drawLatch.countDown()
         }
 
         rule.runOnUiThreadIR {
@@ -540,12 +540,12 @@
     // check bottom corners
     assertColor(outerColor, 0, last - 4)
     assertColor(innerColor, 4, last - 4)
-    assertColor(outerColor, last, last - 4)
-    assertColor(innerColor, last - 4, last)
+    assertColor(outerColor, last, last - 6)
+    assertColor(innerColor, last - 6, last)
     // check top center
     assertColor(outerColor, center - 4, 0)
     assertColor(outerColor, center + 4, 0)
-    assertColor(innerColor, center, 4)
+    assertColor(innerColor, center, 8)
 }
 
 fun Bitmap.assertInvertedTriangle(innerColor: Color, outerColor: Color) {
@@ -565,7 +565,7 @@
     // check bottom center
     assertColor(outerColor, center - 4, last)
     assertColor(outerColor, center + 4, last)
-    assertColor(innerColor, center, last - 4)
+    assertColor(innerColor, center, last - 6)
 }
 
 fun Bitmap.assertColor(expectedColor: Color, x: Int, y: Int) {