[vte/wip/sixels: 31/82] image: Fix function decls and improve member naming



commit b744267505f85a30cdfa1ca4a7eba228deead357
Author: Hans Petter Jansson <hpj cl no>
Date:   Wed Jun 3 22:08:53 2020 +0200

    image: Fix function decls and improve member naming

 src/image.cc | 16 ++++++++--------
 src/image.hh | 34 +++++++++++++++++-----------------
 2 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/src/image.cc b/src/image.cc
index 53115752..86012a8e 100644
--- a/src/image.cc
+++ b/src/image.cc
@@ -29,22 +29,22 @@ namespace image {
 
 /* Test whether this image contains given image */
 bool
-Image::contains(const Image &other) const
+Image::contains(const Image &other) const noexcept
 {
-        return other.m_left >= m_left &&
-               other.m_top >= m_top &&
-               other.m_left + other.m_width <= m_left + m_width &&
-               other.m_top + other.m_height <= m_top + m_height;
+        return other.m_left_cells >= m_left_cells &&
+               other.m_top_cells >= m_top_cells &&
+               other.m_left_cells + other.m_width_cells <= m_left_cells + m_width_cells &&
+               other.m_top_cells + other.m_height_cells <= m_top_cells + m_height_cells;
 }
 
 /* Paint the image with provided cairo context */
 void
-Image::paint(cairo_t *cr, int offsetx, int offsety)
+Image::paint(cairo_t *cr, int offset_x, int offset_y) const noexcept
 {
         cairo_save(cr);
-        cairo_rectangle(cr, offsetx, offsety, m_pixelwidth, m_pixelheight);
+        cairo_rectangle(cr, offset_x, offset_y, m_width_pixels, m_height_pixels);
         cairo_clip(cr);
-        cairo_set_source_surface(cr, m_surface.get(), offsetx, offsety);
+        cairo_set_source_surface(cr, m_surface.get(), offset_x, offset_y);
         cairo_paint(cr);
         cairo_restore(cr);
 }
diff --git a/src/image.hh b/src/image.hh
index d733fe16..d03182c5 100644
--- a/src/image.hh
+++ b/src/image.hh
@@ -31,36 +31,36 @@ private:
         vte::cairo::Surface m_surface{};
 
         // Image dimensions in pixels
-        int m_pixelwidth;
-        int m_pixelheight;
+        int m_width_pixels;
+        int m_height_pixels;
 
         // Image geometry in cell units
-        int m_left;
-        int m_top;
-        int m_width;
-        int m_height;
+        int m_left_cells;
+        int m_top_cells;
+        int m_width_cells;
+        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
                 : m_surface{std::move(surface)},
-                  m_pixelwidth{width_pixels},
-                  m_pixelheight{height_pixels},
-                  m_left{col},
-                  m_top{row},
-                  m_width{width_cells},
-                  m_height{height_cells}
+                  m_width_pixels{width_pixels},
+                  m_height_pixels{height_pixels},
+                  m_left_cells{col},
+                  m_top_cells{row},
+                  m_width_cells{width_cells},
+                  m_height_cells{height_cells}
         {
         }
 
-        inline constexpr auto get_left() const noexcept { return m_left; }
-        inline constexpr auto get_top() const noexcept { return m_top; }
-        inline constexpr auto get_bottom() const noexcept { return m_top + m_height - 1; }
+        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; }
         inline auto resource_size() const noexcept {
-                return cairo_image_surface_get_stride(m_surface.get()) * m_pixelheight;
+                return cairo_image_surface_get_stride(m_surface.get()) * m_height_pixels;
         }
         bool contains(const Image &other) const noexcept;
-        void paint(cairo_t *cr, gint offsetx, gint offsety) const noexcept;
+        void paint(cairo_t *cr, gint offset_x, gint offset_y) const noexcept;
 };
 
 } // namespace image


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]