1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

LibGUI: Improve IconView performance with large selections

This implements the following optimizations:

* Rather than clearing a HashTable of selected items and re-populating
  it every time the selection rectangle changes, determine the delta
  by only examining the items that might be in the area where the
  selection may have changed compared to the previous area. Then
  only add/remove selection items as needed.

* When painting, only query and paint the items actually visible.
  Also, keep a local cache of item information such as calculated
  rectangles and selection state, so it doesn't have to be calculated
  over and over again.
This commit is contained in:
Tom 2020-07-11 07:02:03 -06:00 committed by Andreas Kling
parent b778804d20
commit f266f0e880
4 changed files with 449 additions and 101 deletions

View file

@ -83,6 +83,12 @@ protected:
virtual void drop_event(DropEvent&) override;
virtual void leave_event(Core::Event&) override;
virtual void clear_selection();
virtual void set_selection(const ModelIndex&);
virtual void add_selection(const ModelIndex&);
virtual void remove_selection(const ModelIndex&);
virtual void toggle_selection(const ModelIndex&);
virtual void did_scroll() override;
void set_hovered_index(const ModelIndex&);
void activate(const ModelIndex&);