[vte/wip/sixels: 22/111] image: image_object -> Image




commit 54f38f77055943f5ae422774f3bafdb9c81f1b60
Author: Hans Petter Jansson <hpj cl no>
Date:   Sat Aug 8 20:42:48 2020 +0200

    image: image_object -> Image

 src/image.cc | 38 +++++++++++++++++++-------------------
 src/image.hh | 12 ++++++------
 src/ring.cc  | 10 +++++-----
 src/ring.hh  |  2 +-
 src/vte.cc   |  8 ++++----
 5 files changed, 35 insertions(+), 35 deletions(-)
---
diff --git a/src/image.cc b/src/image.cc
index e8e0e71a..bb599728 100644
--- a/src/image.cc
+++ b/src/image.cc
@@ -24,8 +24,8 @@ namespace vte {
 
 namespace image {
 
-/* image_object implementation */
-image_object::image_object (cairo_surface_t *surface, gint pixelwidth, gint pixelheight, gint col, gint row, 
gint w, gint h, _VteStream *stream)
+/* Image implementation */
+Image::Image (cairo_surface_t *surface, gint pixelwidth, gint pixelheight, gint col, gint row, gint w, gint 
h, _VteStream *stream)
 {
        m_pixelwidth = pixelwidth;
        m_pixelheight = pixelheight;
@@ -39,7 +39,7 @@ image_object::image_object (cairo_surface_t *surface, gint pixelwidth, gint pixe
        g_object_ref (m_stream);
 }
 
-image_object::~image_object ()
+Image::~Image ()
 {
        if (m_surface)
                cairo_surface_destroy (m_surface);
@@ -47,39 +47,39 @@ image_object::~image_object ()
 }
 
 glong
-image_object::get_left () const
+Image::get_left () const
 {
        return (glong)m_left;
 }
 
 glong
-image_object::get_top () const
+Image::get_top () const
 {
        return (glong)m_top;
 }
 
 glong
-image_object::get_bottom () const
+Image::get_bottom () const
 {
        return (glong)(m_top + m_height - 1);
 }
 
 gulong
-image_object::get_stream_position () const
+Image::get_stream_position () const
 {
        return m_position;
 }
 
 /* Indicate whether the image is serialized to the stream */
 bool
-image_object::is_freezed () const
+Image::is_freezed () const
 {
        return (m_surface == NULL);
 }
 
 /* Test whether this image includes given image */
 bool
-image_object::includes (const image_object *other) const
+Image::includes (const Image *other) const
 {
        g_assert_true (other != NULL);
 
@@ -90,7 +90,7 @@ image_object::includes (const image_object *other) const
 }
 
 size_t
-image_object::resource_size () const
+Image::resource_size () const
 {
        size_t result_size;
 
@@ -111,7 +111,7 @@ image_object::resource_size () const
 
 /* Deserialize the cairo image from the temporary file */
 bool
-image_object::thaw ()
+Image::thaw ()
 {
        if (m_surface)
                return true;
@@ -128,7 +128,7 @@ image_object::thaw ()
 
 /* Serialize the image for saving RAM */
 void
-image_object::freeze ()
+Image::freeze ()
 {
        cairo_status_t status;
        double x_scale, y_scale;
@@ -160,7 +160,7 @@ image_object::freeze ()
 
 /* Merge another image into this image */
 bool
-image_object::combine (image_object *other, gulong char_width, gulong char_height)
+Image::combine (Image *other, gulong char_width, gulong char_height)
 {
        cairo_t *cr;
 
@@ -188,7 +188,7 @@ image_object::combine (image_object *other, gulong char_width, gulong char_heigh
 }
 
 bool
-image_object::unite (image_object *other, gulong char_width, gulong char_height)
+Image::unite (Image *other, gulong char_width, gulong char_height)
 {
        if (is_freezed ())
                if (! thaw ())
@@ -226,7 +226,7 @@ image_object::unite (image_object *other, gulong char_width, gulong char_height)
 
 /* Paint the image into given cairo rendering context */
 bool
-image_object::paint (cairo_t *cr, gint offsetx, gint offsety)
+Image::paint (cairo_t *cr, gint offsetx, gint offsety)
 {
        if (is_freezed ())
                if (! thaw ())
@@ -245,9 +245,9 @@ image_object::paint (cairo_t *cr, gint offsetx, gint offsety)
 /* callback routines for stream I/O */
 
 cairo_status_t
-image_object::read_callback (void *closure, char *data, unsigned int length)
+Image::read_callback (void *closure, char *data, unsigned int length)
 {
-       image_object *image = (image_object *)closure;
+       Image *image = (Image *)closure;
 
        g_assert_true (image != NULL);
 
@@ -258,9 +258,9 @@ image_object::read_callback (void *closure, char *data, unsigned int length)
 }
 
 cairo_status_t
-image_object::write_callback (void *closure, const char *data, unsigned int length)
+Image::write_callback (void *closure, const char *data, unsigned int length)
 {
-       image_object *image = (image_object *)closure;
+       Image *image = (Image *)closure;
 
        g_assert_true (image != NULL);
 
diff --git a/src/image.hh b/src/image.hh
index 76d4af20..f0b7025c 100644
--- a/src/image.hh
+++ b/src/image.hh
@@ -23,7 +23,7 @@ namespace vte {
 
 namespace image {
 
-struct image_object {
+struct Image {
 private:
        gint m_left;                /* left position in cell unit at the vte virtual screen */
        gint m_width;               /* width in cell unit */
@@ -37,19 +37,19 @@ private:
        size_t m_nwrite;            /* private use: for write callback */
        cairo_surface_t *m_surface; /* internal cairo image */
 public:
-       explicit image_object (cairo_surface_t *surface, gint pixelwidth, gint pixelheight, gint col, gint 
row, gint w, gint h, _VteStream *stream);
-       ~image_object ();
+       explicit Image (cairo_surface_t *surface, gint pixelwidth, gint pixelheight, gint col, gint row, gint 
w, gint h, _VteStream *stream);
+       ~Image ();
        glong get_left () const;
        glong get_top () const;
        glong get_bottom () const;
        gulong get_stream_position () const;
        bool is_freezed () const;
-       bool includes (const image_object *rhs) const;
+       bool includes (const Image *rhs) const;
        size_t resource_size () const;
        void freeze ();
        bool thaw ();
-       bool combine (image_object *rhs, gulong char_width, gulong char_height);
-       bool unite (image_object *rhs, gulong char_width, gulong char_height);
+       bool combine (Image *rhs, gulong char_width, gulong char_height);
+       bool unite (Image *rhs, gulong char_width, gulong char_height);
        bool paint (cairo_t *cr, gint offsetx, gint offsety);
 public:
        static cairo_status_t read_callback (void *closure, char *data, unsigned int length);
diff --git a/src/ring.cc b/src/ring.cc
index 8cd473db..9bf6b3b3 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -88,7 +88,7 @@ Ring::Ring(row_t max_rows,
         auto empty_str = g_string_new_len("", 0);
         g_ptr_array_add(m_hyperlinks, empty_str);
 
-        m_image_map = new (std::nothrow) std::map<gint, vte::image::image_object *>();
+        m_image_map = new (std::nothrow) std::map<gint, vte::image::Image *>();
         m_image_onscreen_resource_counter = 0;
         m_image_offscreen_resource_counter = 0;
 
@@ -1524,10 +1524,10 @@ void
 Ring::append_image (cairo_surface_t *surface, gint pixelwidth, gint pixelheight, glong left, glong top, 
glong width, glong height)
 {
        using namespace vte::image;
-       image_object *image;
+       Image *image;
        gulong char_width, char_height;
 
-       image = new (std::nothrow) image_object (surface, pixelwidth, pixelheight, left, top, width, height, 
m_image_stream);
+       image = new (std::nothrow) Image (surface, pixelwidth, pixelheight, left, top, width, height, 
m_image_stream);
        g_assert_true (image != NULL);
 
        char_width = pixelwidth / width;
@@ -1535,7 +1535,7 @@ Ring::append_image (cairo_surface_t *surface, gint pixelwidth, gint pixelheight,
 
        /* composition */
        for (auto it = m_image_map->lower_bound (top); it != m_image_map->end (); ) {
-               image_object *current = it->second;
+               Image *current = it->second;
 
                /* Combine two images if one's area includes another's area */
                if (image->includes (current)) {
@@ -1638,7 +1638,7 @@ void
 Ring::shrink_image_stream ()
 {
        using namespace vte::image;
-       image_object *first_image;
+       Image *first_image;
 
        if (m_image_map->empty())
                return;
diff --git a/src/ring.hh b/src/ring.hh
index ea3d983f..3834c81f 100644
--- a/src/ring.hh
+++ b/src/ring.hh
@@ -112,7 +112,7 @@ public:
        row_t m_start{0};
         row_t m_end{0};
 
-        std::map<gint, vte::image::image_object *> *m_image_map;
+        std::map<gint, vte::image::Image *> *m_image_map;
         gulong m_image_onscreen_resource_counter;
         gulong m_image_offscreen_resource_counter;
 
diff --git a/src/vte.cc b/src/vte.cc
index df24f078..ee5dbc99 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -4237,7 +4237,7 @@ Terminal::maybe_remove_images ()
 {
        VteRing *ring = m_screen->row_data;
        auto image_map = ring->m_image_map;
-       vte::image::image_object *image;
+       vte::image::Image *image;
 
        auto it = image_map->begin();
 
@@ -4307,7 +4307,7 @@ Terminal::freeze_hidden_images_before_view_area (double start_pos, double end_po
 
        /* iterate from new to old */
        for (auto it = map_t::reverse_iterator (image_map->lower_bound (top_of_view)); it != image_map->rend 
(); ++it) {
-               vte::image::image_object *image = it->second;
+               vte::image::Image *image = it->second;
                if (image->get_bottom () + 1 < end_pos)
                        break;
                if (! image->is_freezed ()) {
@@ -4331,7 +4331,7 @@ Terminal::freeze_hidden_images_after_view_area (double start_pos, double end_pos
 
        /* for images after view area */
        for (auto it = image_map->lower_bound (bottom_of_view); it != image_map->end (); ++it) {
-               vte::image::image_object *image = it->second;
+               vte::image::Image *image = it->second;
                if (image->get_top () < end_pos + m_row_count)
                        break;
                if (image->get_top () > bottom_of_view && ! image->is_freezed ()) {
@@ -9378,7 +9378,7 @@ Terminal::widget_draw(cairo_t *cr)
                auto image_map = ring->m_image_map;
                auto it = image_map->lower_bound (top_row);
                for (; it != image_map->end (); ++it) {
-                       vte::image::image_object *image = it->second;
+                       vte::image::Image *image = it->second;
                        if (image->get_top () > bottom_row)
                                break;
                        if (image->is_freezed ()) {


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