How to efficently draw large skia interfaces

hi all,

I have nested “draw instructions” for my ui elements, they all use the same datatype.
Scenes and elements can be updated and changed during runtime.

<scenes>
  <scene1>
    <element1>
    <element2>
  </scene1>
  <scene2>
   <element1>
  </scene2>
</scenes>

atm I feed this Spread of spreads into a giant loop, to draw the individual skia elements.
a scene manager sets which scenes are visible and what should be evaluated (green)
depending on the type of my element, the corresponding skia drawer is evaluated. (red)

(of course) this scales quite badly, and it seems to me this is the perfect place to use an interface.
I found no tutorials regarding vl interfaces. Is this the way to go, or can you recommend another programming paradigm to replace this construction?

imo the fastest way, would be to just have all visible elements running the loop. create the specific drawer before the element becomes visible, and destroy it afterwards. I did not start refactoring yet because I am not sure how the skia elements will behave regarding jittering when they are being created during runtime. the current patch runs pretty smooth.

all assets are already preloaded at the time and available as a datatype. but I also use video players from media foundation and hap in there. I already tried dissecting elementa, but this is a tad too complex for me.

Any tips appreciated!

You could make an interface called IDraw which implement the stuff that are in common to those DrawButton, DrawText etc… such as Layer output I guess and a DoEvaluate maybe.

Then you could create all your UIElement at startup and store all of them in a spread. Finally you foreach everything (similar to what I can see on your screenshot) and
access the IDraw’s GetLayer process for rendering everything in the spread at once.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.