From 9343a456a5a3411cdad78d7ad0dc6051162f16d8 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Thu, 18 Apr 2024 15:56:18 +0200 Subject: [PATCH] Revert "Do not measure clipped graphics" This reverts commit ac6cd203452bcdebfd5cd5bd34f32bacf4d70f20. --- .../compose/ui/platform/RenderNodeLayer.skiko.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/RenderNodeLayer.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/RenderNodeLayer.skiko.kt index 87c3cdb9eafeb..e676e3e04b3bb 100644 --- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/RenderNodeLayer.skiko.kt +++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/RenderNodeLayer.skiko.kt @@ -19,7 +19,6 @@ package androidx.compose.ui.platform import org.jetbrains.skia.Rect as SkRect import androidx.compose.ui.geometry.MutableRect import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.RoundRect import androidx.compose.ui.geometry.toRect import androidx.compose.ui.graphics.Canvas @@ -43,7 +42,6 @@ import androidx.compose.ui.graphics.asSkiaPath import androidx.compose.ui.graphics.nativeCanvas import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.graphics.toSkiaRRect -import androidx.compose.ui.graphics.toSkiaRect import androidx.compose.ui.node.OwnedLayer import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.IntOffset @@ -239,12 +237,11 @@ internal class RenderNodeLayer( override fun drawLayer(canvas: Canvas) { if (picture == null) { - val bounds = size.toSize().toRect() val pictureCanvas = pictureRecorder.beginRecording( - bounds = if (clip) bounds.toSkiaRect() else PICTURE_BOUNDS, - bbh = if (clip) null else bbhFactory + bounds = PICTURE_BOUNDS, + bbh = bbhFactory ) - performDrawLayer(pictureCanvas.asComposeCanvas(), bounds) + performDrawLayer(pictureCanvas.asComposeCanvas()) picture = pictureRecorder.finishRecordingAsPicture() } @@ -263,7 +260,7 @@ internal class RenderNodeLayer( matrix.timesAssign(inverseMatrix) } - private fun performDrawLayer(canvas: Canvas, bounds: Rect) { + private fun performDrawLayer(canvas: Canvas) { if (alpha > 0) { if (shadowElevation > 0) { drawShadow(canvas) @@ -284,6 +281,7 @@ internal class RenderNodeLayer( currentRenderEffect != null || compositingStrategy == CompositingStrategy.Offscreen if (requiresLayer) { + val bounds = size.toSize().toRect() canvas.saveLayer( bounds, Paint().apply {