Is there anyone having this issue with desktop ? R...
# compose-desktop
m
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
I have never seen that before although I have published a desktop app on all three platforms which heavily uses the canvas.
m
The project is an interactive drawing app, the user can draw paths, shapes... it happens when I draw some shapes
m
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
It happens on two windows machines, it's not happening in macOs
d
Can you please create a minimal reproducible sample on GitHub ?
m
@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
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
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
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
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