JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.9k stars 1.16k forks source link

graphicsLayer render resolution slower towards bottom of screen #4998

Open mgroth0 opened 2 months ago

mgroth0 commented 2 months ago

Describe the bug

When using graphicsLayer (or clip, which uses graphicsLayer) the shape is rendered with a lower resolution as it moves down the screen. In other words, if you have a column of the same shape drawn the same way from the top to the bottom of the screen, the shape is rendered perfectly smooth at the top of the screen and very pixelated at the bottom.

Affected platforms Desktop (macOS)

Versions

To Reproduce

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.GenericShape
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application

fun main() {
    val triangle =
        GenericShape { size, _ ->
            moveTo(
                x = 0f,
                y = 0f
            )
            lineTo(
                x = size.width,
                y = size.height / 2
            )
            lineTo(
                x = 0f,
                y = size.height
            )
            close()
        }
    application {
        Window(onCloseRequest = ::exitApplication) {
            Row {
                Column {
                    repeat(100) {
                        Box(
                            modifier =
                                Modifier
                                    .clip(triangle)
                                    .background(Color.Black)
                                    .size(25.dp)
                        )
                    }
                }
            }
        }
    }
}

Expected behavior

Resolution should not change relative to the y value within a single screen.

Screenshots

This image was taken on a vertical 4k monitor. The code is above, in the reproduction section.

Screenshot 2024-06-19 at 2 09 10 PM
mgroth0 commented 1 month ago

Hey @MatkovIvan , just checking in. I noticed that many of the issues on this repo were automatically moved to YouTrack. However, this one wasn't. What is the current status of this, and will it be moved to YouTrack?

MatkovIvan commented 1 month ago

The cause of the issue is not clear, it requires more detailed investigation.

For the moving to YT - it's kind of in progress (script issues + delays because of vacations), all the issues will be moved

okushnikov commented 2 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.