From 79424e86dd7aa28c1b25868d86fa8ebffc801593 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 10 Mar 2025 12:45:14 -0400 Subject: Optimized AreaPopup indicators The list of indicators and the size of the window are calculated only when necessary (new connection, DPI changed, or hunt panel settings changed) and otherwise all we do is redraw the image. --- src/area_popup.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/area_popup.h') diff --git a/src/area_popup.h b/src/area_popup.h index 2401e4e..50e10e8 100644 --- a/src/area_popup.h +++ b/src/area_popup.h @@ -7,13 +7,32 @@ #include #endif +#include + class AreaPopup : public wxScrolledCanvas { public: AreaPopup(wxWindow* parent, int area_id); + void ResetIndicators(); void UpdateIndicators(); private: + enum IndicatorType { + kLOCATION, + kPAINTING, + }; + + struct IndicatorInfo { + // For locations, the id is an index into the map area's locations list. + // For paintings, it is a real painting id. + int id; + IndicatorType type; + int y; + + IndicatorInfo(int id, IndicatorType type, int y) + : id(id), type(type), y(y) {} + }; + void OnPaint(wxPaintEvent& event); void OnDPIChanged(wxDPIChangedEvent& event); @@ -26,6 +45,12 @@ class AreaPopup : public wxScrolledCanvas { const wxBitmap* unchecked_owl_; const wxBitmap* checked_owl_; + int full_width_ = 0; + int full_height_ = 0; + wxSize header_extent_; + + std::vector indicators_; + wxBitmap rendered_; }; -- cgit 1.4.1