[Cuis-dev] Morph redrawNeeded

Juan Vuletich juan at cuis.st
Wed May 3 07:39:31 PDT 2023


On 5/2/2023 5:42 PM, Jon Hylands via Cuis-dev wrote:
>
> Hi everyone,
>
> I'm doing some GUI work on a Raspberry pi 4 that has a 1080p HDMI LCD 
> screen (in portrait mode).
>
> I have a special morph, which displays a list of nearby airports, 
> sorted by distance from the user's gps location. The morph can show 9 
> airports at a time, and you can smoothly scroll the list (which has a 
> couple hundred entries in total).
>
> ...
>
> On my desktop, it takes about 14ms to draw the 9 entries, and I get 
> about 11 frames per second scrolling. The scroll code is implemented 
> in a method called from #mouseMove:localPosition:, and it simply does 
> some math, sets the scrollPosition variable, and calls #redrawNeeded.
>
> On the rpi4, it takes about 50ms to draw the list, and it averages 2.5 
> frames per second, which is terrible.
>
> On my desktop, it appears that there is a fairly large gap (50ms) 
> between the time #redrawNeeded is sent, and the corresponding call to 
> #drawOn: is sent. This explains the poor performance pretty much in 
> total. What can I do to make that happen faster?
>
> - Jon
>

Hi Jon,

It really looks like it could be way faster, both on the Raspi and your 
Desktop. The first thing that comes to mind is that text rendering is 
much slower if there's scaling or rotation. So, the first advice is to 
be sure that all the morphs involved in the list, up to world, don't do 
rotation or scaling (their locations should only be integer 
translations). If needed, use a different font size.

Yep. If I zoom in your screenshot, I can see that the letters 'o' in 
'London' have subpixels rendered differently. This is geometrically 
correct, but it shows that it is not caching font glyphs, but drawing 
the TrueType Beziers each time. Caching is only done if there's no zoom 
or rotation, and it really speeds up text rendering.

If the above doesn't help, I'd like to be able to reproduce the 
behavior, so I can understand in detail. I have a Raspi 3B I can use for 
testing. If the issue persists, please prepare an image, or some 
instructions to load the code, so I can try.

Thanks,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list