Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Do not measure clipped graphics" #1285

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()
}

Expand All @@ -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)
Expand All @@ -284,6 +281,7 @@ internal class RenderNodeLayer(
currentRenderEffect != null ||
compositingStrategy == CompositingStrategy.Offscreen
if (requiresLayer) {
val bounds = size.toSize().toRect()
canvas.saveLayer(
bounds,
Paint().apply {
Expand Down
Loading