[vte/wip/sixels: 49/111] image: Store draw/prune priority in image
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/sixels: 49/111] image: Store draw/prune priority in image
- Date: Sat, 8 Aug 2020 18:43:01 +0000 (UTC)
commit 7a7ebe064d7e511470dca91647cfbc60fb201fda
Author: Hans Petter Jansson <hpj cl no>
Date: Sat Aug 8 20:42:48 2020 +0200
image: Store draw/prune priority in image
src/image.hh | 12 ++++++++++--
src/ring.cc | 8 ++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/image.hh b/src/image.hh
index d03182c5..01fec072 100644
--- a/src/image.hh
+++ b/src/image.hh
@@ -30,6 +30,9 @@ private:
// Device-friendly Cairo surface
vte::cairo::Surface m_surface{};
+ // Draw/prune priority, must be unique
+ int m_priority;
+
// Image dimensions in pixels
int m_width_pixels;
int m_height_pixels;
@@ -41,9 +44,13 @@ private:
int m_height_cells;
public:
- Image(vte::cairo::Surface&& surface, int width_pixels, int height_pixels,
- int col, int row, int width_cells, int height_cells) noexcept
+ Image(vte::cairo::Surface&& surface,
+ int priority,
+ int width_pixels, int height_pixels,
+ int col, int row,
+ int width_cells, int height_cells) noexcept
: m_surface{std::move(surface)},
+ m_priority{priority},
m_width_pixels{width_pixels},
m_height_pixels{height_pixels},
m_left_cells{col},
@@ -53,6 +60,7 @@ public:
{
}
+ inline constexpr auto get_priority() const noexcept { return m_priority; }
inline constexpr auto get_left() const noexcept { return m_left_cells; }
inline constexpr auto get_top() const noexcept { return m_top_cells; }
inline constexpr auto get_bottom() const noexcept { return m_top_cells + m_height_cells - 1; }
diff --git a/src/ring.cc b/src/ring.cc
index ded298d1..e711e683 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -1528,7 +1528,11 @@ Ring::append_image (cairo_surface_t *surface, gint pixelwidth, gint pixelheight,
Image *image;
gulong char_width, char_height;
- image = new (std::nothrow) Image (vte::cairo::Surface(surface), pixelwidth, pixelheight, left, top,
width, height);
+ image = new (std::nothrow) Image (vte::cairo::Surface(surface),
+ m_next_image_priority++,
+ pixelwidth, pixelheight,
+ left, top,
+ width, height);
g_assert_true (image != NULL);
char_width = pixelwidth / width;
@@ -1559,7 +1563,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_priority_map->insert (std::make_pair (image->get_priority (), image));
m_image_onscreen_resource_counter += image->resource_size ();
end:
/* noop */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]