Regarding Android compose and skia rendering sync problem

36 views
Skip to first unread message

Sowmyyy Reanz

unread,
Aug 11, 2025, 9:27:51 AMAug 11
to skia-discuss
Team, 
We had drawn a rect using compose framework in android like
Canvas(modifier = Modifier.fillMaxSize()

.statusBarsPadding()
.navigationBarsPadding()
.background(Color.Transparent)) {
drawRect(
color = Color.Red,
topLeft = rectPos.value,
size = Size(400f400f)
)
}
Similarly, same rect is drawn using SKIA openGL and rendered in the GLSurfaceView component  of android and parallely we have a scroll gesture and the scrolled offset is calculated and set to both rects when scrolled to move along. But both the rects are not moved in sync
We used Choreographer API in android to make it happen in vertical synchronisation, still the same issue
I will attach the screenshot of my drawing where red filled rect is drawn using compose and the white rect is drawn using SKIA in JNI wrapper and linked to  GL
When scrolled both rects are moved along with offsets, whereas compose rect moves first and the white follows it in view 
can anyone help with this?
asyncimage.pngsurface view.

Noelle Scobie

unread,
Aug 11, 2025, 1:57:23 PMAug 11
to skia-d...@googlegroups.com
Hi, thanks for reaching out. This question is likely an Android issue beyond the scope of Skia and should probably be directed to the Jetpack Compose issue tracker, but I have a few clarifying questions:
  • I presume you're testing on a device running at least Android 7 (Nougat / API 24)? It looks like there were some SurfaceView synchronization issues before then.
  • Is your SurfaceView the size of the white rect, and the entire SurfaceView is being moved? Or is the SurfaceView the size of the entire app, and Skia is drawing both the black background and then a white rect that is manually repositioned inside the larger canvas on scroll?

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/skia-discuss/ac339034-ace8-4a0d-a318-1cfe9784b44fn%40googlegroups.com.

Sowmyyy Reanz

unread,
Aug 14, 2025, 9:32:36 AMAug 14
to skia-discuss
Hi thanks for your clarification!
Yeah , we are using latest android versions!
Black view is GLSurfaceView of android where GPU rendering happens,  red rect is drawn using compose framework. White rect is drawn using SKIA openGL and swapped to GlSurface View of android 
Since compose also renders in GPU and uses skia internally, we need this swap(compose swap and SKIA rendering swap)  to be occurred in the same frame so that both rect moves in sync right?
Reply all
Reply to author
Forward
0 new messages