Drawing widgets is time-consuming
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
- Jakub Sękowski: Approve
- Adam Malinowski: Approve
-
Diff: 712 lines (+217/-108)22 files modifiedsrc/CDisplay.cpp (+10/-2)
src/CDisplay.hpp (+2/-0)
src/IDrawable.cpp (+46/-10)
src/IDrawable.hpp (+45/-3)
src/WBox.hpp (+1/-1)
src/WButton.cpp (+6/-7)
src/WButton.hpp (+3/-2)
src/WFixed.cpp (+8/-5)
src/WFixed.hpp (+1/-1)
src/WHBox.cpp (+7/-11)
src/WHBox.hpp (+1/-1)
src/WImage.cpp (+4/-5)
src/WImage.hpp (+1/-1)
src/WLabel.cpp (+2/-3)
src/WLabel.hpp (+1/-1)
src/WLayeredView.cpp (+6/-2)
src/WLayeredView.hpp (+2/-1)
src/WOrderedContainer.cpp (+12/-2)
src/WOrderedContainer.hpp (+1/-1)
src/WVBox.cpp (+8/-11)
src/WVBox.hpp (+1/-1)
src/main.cpp (+49/-37)
Changed in millenniumduel: | |
assignee: | nobody → Rafał Cieślak (rafalcieslak256) |
Changed in millenniumduel: | |
status: | Triaged → Fix Committed |
Changed in millenniumduel: | |
status: | Fix Committed → Fix Released |