[vte/wip/sixels: 36/82] ring: Add priority map to draw and prune images in order of appearance
- From: Hans Petter Jansson <hansp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/sixels: 36/82] ring: Add priority map to draw and prune images in order of appearance
- Date: Fri, 26 Jun 2020 00:46:08 +0000 (UTC)
commit 2e1f97d2652f66b3114e14dcfaf3e77df379359f
Author: Hans Petter Jansson <hpj cl no>
Date: Tue Jun 9 00:28:44 2020 +0200
ring: Add priority map to draw and prune images in order of appearance
src/ring.cc | 7 +++++++
src/ring.hh | 3 +++
2 files changed, 10 insertions(+)
---
diff --git a/src/ring.cc b/src/ring.cc
index 35422f7f..a6c36073 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -87,7 +87,9 @@ Ring::Ring(row_t max_rows,
auto empty_str = g_string_new_len("", 0);
g_ptr_array_add(m_hyperlinks, empty_str);
+ m_next_image_priority = 0;
m_image_map = new (std::nothrow) std::map<gint, vte::image::Image *>();
+ m_image_priority_map = new (std::nothrow) std::map<int, vte::image::Image *>();
m_image_onscreen_resource_counter = 0;
m_image_offscreen_resource_counter = 0;
@@ -108,6 +110,7 @@ Ring::~Ring()
delete it->second;
image_map->clear();
delete m_image_map;
+ delete m_image_priority_map;
if (m_has_streams) {
g_object_unref (m_attr_stream);
@@ -610,6 +613,9 @@ Ring::reset()
for (auto it = image_map->begin (); it != image_map->end (); ++it)
delete it->second;
image_map->clear();
+ m_image_priority_map->clear();
+ m_next_image_priority = 0;
+
if (m_has_streams)
_vte_stream_reset (m_image_stream, _vte_stream_head (m_image_stream));
@@ -1556,6 +1562,7 @@ Ring::append_image (cairo_surface_t *surface, gint pixelwidth, gint pixelheight,
* +----------+ <- bottom position (key)
*/
m_image_map->insert (std::make_pair (image->get_bottom (), image));
+ m_image_priority_map->insert (std::make_pair (m_next_image_priority++, image));
m_image_onscreen_resource_counter += image->resource_size ();
end:
/* noop */
diff --git a/src/ring.hh b/src/ring.hh
index 3834c81f..ba40c49c 100644
--- a/src/ring.hh
+++ b/src/ring.hh
@@ -112,7 +112,10 @@ public:
row_t m_start{0};
row_t m_end{0};
+ int m_next_image_priority;
+
std::map<gint, vte::image::Image *> *m_image_map;
+ std::map<int, vte::image::Image *> *m_image_priority_map;
gulong m_image_onscreen_resource_counter;
gulong m_image_offscreen_resource_counter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]