Drawing widgets is time-consuming

Bug #1204559 reported by Rafał Cieślak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Millennium Duel
Fix Released
High
Rafał Cieślak

Bug Description

The drawing model we currently use is extremely inefficient.

The display keeps redrawing relentlessly. Each time we process all visible widgets and redraw them. With a larger number of widgets, the interface will start lagging.

I've run valgrind's profiler, and it turns out that about 50% of code execution time is spend rendering fonts.

Why don't we render them once, and use a pre-rendered bitmap next times?
Of course, the bitmap would need to be re-rendered when the text is changed or the drawing area resizes. But that happens relatively rarely, and therefore such approach would improve our efficiency a lot.

This concept may be generalised, let all drawables have a needs_redraw flag that causes the pre-rendered "buffer" bitmap to be redrawn, and in all other cases draw() would simply use that buffer to draw onto the display.

Related branches

Adam Malinowski (adayah)
Changed in millenniumduel:
assignee: nobody → Rafał Cieślak (rafalcieslak256)
Jakub Sękowski (sequba)
Changed in millenniumduel:
status: Triaged → Fix Committed
Changed in millenniumduel:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.