[vte] lib: sixel: Update bbox when inserting an image



commit d5a6a30166a951740c7a4fd2c07ead3fbbe2e1ec
Author: Christian Persch <chpe src gnome org>
Date:   Fri Oct 23 19:55:05 2020 +0200

    lib: sixel: Update bbox when inserting an image
    
    This should fix a problem where sometimes the image wouldn't scroll into view.

 src/vte.cc         | 11 ++++++++---
 src/vteinternal.hh |  3 ++-
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 6c78f661..855ca454 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -3119,7 +3119,8 @@ not_inserted:
 #ifdef WITH_SIXEL
 
 void
-Terminal::insert_image(vte::Freeable<cairo_surface_t> image_surface) /* throws */
+Terminal::insert_image(ProcessingContext& context,
+                       vte::Freeable<cairo_surface_t> image_surface) /* throws */
 {
         if (!image_surface)
                 return;
@@ -3162,8 +3163,12 @@ Terminal::insert_image(vte::Freeable<cairo_surface_t> image_surface) /* throws *
                                          m_cell_width_unscaled,
                                          m_cell_height_unscaled);
 
-        /* Erase characters under the image */
+        /* Erase characters under the image. Since this inserts content, we need
+         * to update the processing context's bbox.
+         */
+        context.pre_GRAPHIC(*this);
         erase_image_rect(height, width);
+        context.post_GRAPHIC(*this);
 }
 
 #endif /* WITH_SIXEL */
@@ -3904,7 +3909,7 @@ Terminal::process_incoming_decsixel(ProcessingContext& context,
                         break;
 
                 try {
-                        insert_image(m_sixel_context->image_cairo());
+                        insert_image(context, m_sixel_context->image_cairo());
                 } catch (...) {
                 }
 
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index bce1744c..7fb233c6 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -749,7 +749,8 @@ public:
                          bool invalidate_now);
 
         #ifdef WITH_SIXEL
-        void insert_image(vte::Freeable<cairo_surface_t> image_surface) /* throws */;
+        void insert_image(ProcessingContext& context,
+                          vte::Freeable<cairo_surface_t> image_surface) /* throws */;
         #endif
 
         void invalidate_row(vte::grid::row_t row);


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