Hello guys, first day here, so not aware of all t...
# compose-android
n
Hello guys, first day here, so not aware of all the rules. I am interested in finding how Compose UI is turned into pixels that are drawn on the screen. I have read some snippets here and there about: Skia, RenderNode and stuff. However, I want to look in the source code to understand myself. Not sure where to begin though
s
Short answer: On Android, it uses the View’s Canvas. So, a Compose layout is essentially a big custom View(ComposeView) that draws content onto a Canvas.
👍 1
n
Thank you, I think I worded the question poorly. I am mostly aware of the high level stuff that goes on. I want to understand details like how 200.dp Row with background Red is drawn on the screen through Skia. What are the appropriate source code files to look at in Aosp platform/frameworks/support or the main Aosp branch or the Kotlin plugins compose module
k
please refer to the aosp frameworks/base/libs/hwui and the libhwui.so is what you need to investigate.
👍 1
n
Thank you, I didn't manage to find the libhwui.so file. I guess this would require me to get the main repo and run the build.
f
n
Thank you, The book seems promising, I have purchased it. Side note, their email system seems to be broken. I will try to read it during the weekend.
s
Compose does nothing specific for drawing. It just utilizes system APIs. That book greatly explains many Compose internals except drawing, and has almost nothing about it. Only one chapter with 1.5 pages of general information. Here is a very good presentation by two legends, Chet and Romain, on the topic you’re asking about. While this doesn’t guide you to specific code in AOSP, it provides overall knowledge of the process, which might help you find what you need in the sources https://cs.android.com/android. For instance, search for
DisplayList
, look where and how it is used, jump to another function, etc.

https://www.youtube.com/watch?v=zdQRIYOST64

👍 1
n
Thank you for the detailed explanation. I couldn't find DisplayList java or Kotlin class but there were some hits with CanvasDisplayList. I will watch the video to have better understanding
👍 1
n
Oh, I see. Thank you