From 4907c5cc952e94e32cb0f95ea6f3be361b55d389 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 3 Oct 2020 14:46:57 +0200 Subject: Reduce memory usage by cleaning up text not visible on the screen As a text, memory usage decreased from 150mb to 20mb --- include/Body.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/Body.hpp') diff --git a/include/Body.hpp b/include/Body.hpp index 47de784..bf5f6aa 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -78,6 +78,7 @@ namespace QuickMedia { sf::Color title_color; sf::Color author_color; void *userdata; // Not managed, should be deallocated by whoever sets this + sf::Int32 last_drawn_time; private: std::string title; std::string description; @@ -157,6 +158,8 @@ namespace QuickMedia { sf::Color line_seperator_color; private: void draw_item(sf::RenderWindow &window, BodyItem *item, const sf::Vector2f &pos, const sf::Vector2f &size, const float item_height, const int item_index, const Json::Value &content_progress); + void update_dirty_state(BodyItem *body_item, sf::Vector2f size); + void clear_body_item_cache(BodyItem *body_item); private: Program *program; std::unordered_map> item_thumbnail_textures; @@ -173,5 +176,6 @@ namespace QuickMedia { int num_visible_items; bool last_item_fully_visible; int last_fully_visible_item; + sf::Clock draw_timer; }; } \ No newline at end of file -- cgit v1.2.3