https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
m

mohamed rejeb

09/20/2023, 12:04 PM
Is there anyone having this issue with desktop ? Random rectangles show up on the screen when I draw on canvas. I can't reproduce it, it just happens randomly when I draw (It's a drawing app)
m

Michael Paus

09/20/2023, 3:16 PM
I have never seen that before although I have published a desktop app on all three platforms which heavily uses the canvas.
m

mohamed rejeb

09/20/2023, 3:18 PM
The project is an interactive drawing app, the user can draw paths, shapes... it happens when I draw some shapes
m

Michael Paus

09/20/2023, 3:24 PM
I’d first check under which circumstances this happens and on which OS/machine combinations. Maybe it’s a hardware or graphis driver problem.
m

mohamed rejeb

09/20/2023, 3:29 PM
It happens on two windows machines, it's not happening in macOs
d

Dima Avdeev

09/23/2023, 8:45 PM
Can you please create a minimal reproducible sample on GitHub ?
m

Michael Paus

09/24/2023, 7:05 AM
@mohamed rejeb Looking at the sporadic nature of these glitches, they might indeed be related to the glitches that I see in my PDF tests. The only difference is that I see them on my Mac and you say that you don’t see your glitches on your Mac. What kind of Mac do you have. Intel or ARM? I am still on Intel. (See https://kotlinlang.slack.com/archives/C01D6HTPATV/p1695395804181519 )
m

mohamed rejeb

09/24/2023, 7:11 AM
I'm using Mac M1 not intel, maybe it's something related to skikoX64 ? I'm trying to create a minimal reproducible, AFAIK this happens when I draw a lot of complex paths in a short period of time also those glitches (the rectangles) keeps moving from place to another with every recomposition
m

Michael Paus

09/24/2023, 4:34 PM
Same for me. If I force redraws in quick succession I see more glitches than otherwise. But this may also just be a matter of statistics. Something else I observed is that I do not see such glitches if I first draw into an image and then draw the image onto a canvas. Something like:
Copy code
val composeImage = ImageBitmap(width, height)
val canvas = Canvas(composeImage)
draw graphics into that canvas and then
Copy code
onDrawBehind {
	drawImage(composeImage, offset)
}
m

mohamed rejeb

09/25/2023, 7:11 AM
That's good, I'll try it, for me it's a drawing app if this workaround is going to slow down the drawing process, I can't use it. Also, now I'm trying to run only on release mode to see if it solves the problem. Is it happening for you with release mode?
m

Michael Paus

09/25/2023, 7:54 AM
Release or not doesn’t make a difference for me. If I just force redraws long enough I also see hard crashes of the JVM in the Skiko lib like this:
Copy code
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000016e2efd98, pid=4571, tid=86275
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.8+7 (17.0.8+7) (build 17.0.8+7)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (17.0.8+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libskiko-macos-x64.dylib+0x1aad98]  void SkRecorder::append<SkRecords::DrawPath, SkPaint const&, SkPath const&>(SkPaint const&, SkPath const&)+0x98