[vte] widget: Move some methods to VteTerminalPrivate



commit 59dd40862aa97380b694820c00abe738c5901c5e
Author: Christian Persch <chpe gnome org>
Date:   Sun Dec 6 19:49:37 2015 +0100

    widget: Move some methods to VteTerminalPrivate

 src/vte.cc         |   40 +++++++++++++++++++---------------------
 src/vteinternal.hh |    3 +++
 2 files changed, 22 insertions(+), 21 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 7b901d2..2b80ee3 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -9542,50 +9542,48 @@ fg_out:
        return;
 }
 
-static void
-vte_terminal_expand_region (VteTerminal *terminal, cairo_region_t *region, const GdkRectangle *area)
+void
+VteTerminalPrivate::expand_cairo_region(cairo_region_t *region,
+                                        GdkRectangle const* area) const
 {
-       int width, height;
-       int row, col, row_stop, col_stop;
+        vte::grid::row_t row, row_stop;
+        vte::grid::column_t col, col_stop;
        cairo_rectangle_int_t rect;
        GtkAllocation allocation;
 
-       width = terminal->pvt->char_width;
-       height = terminal->pvt->char_height;
-
-       gtk_widget_get_allocation (&terminal->widget, &allocation);
+       gtk_widget_get_allocation(m_widget, &allocation);
 
        /* increase the paint by one pixel on all sides to force the
         * inclusion of neighbouring cells */
-        row = terminal->pvt->pixel_to_row(MAX(0, area->y - terminal->pvt->padding.top - 1));
+        row = pixel_to_row(MAX(0, area->y - m_padding.top - 1));
         /* Both the value given by MIN() and row_stop are exclusive.
          * _vte_terminal_pixel_to_row expects an actual value corresponding
          * to the bottom visible pixel, hence the - 1 + 1 magic. */
-        row_stop = terminal->pvt->pixel_to_row(MIN(area->height + area->y - terminal->pvt->padding.top + 1,
-                                                            allocation.height - 
terminal->pvt->padding.bottom) - 1) + 1;
+        row_stop = pixel_to_row(MIN(area->height + area->y - m_padding.top + 1,
+                                    allocation.height - m_padding.bottom) - 1) + 1;
        if (row_stop <= row) {
                return;
        }
-       col = MAX(0, (area->x - terminal->pvt->padding.left - 1) / width);
-       col_stop = MIN(howmany(area->width + area->x - terminal->pvt->padding.left + 1, width),
-                      terminal->pvt->column_count);
+       col = MAX(0, (area->x - m_padding.left - 1) / m_char_width);
+       col_stop = MIN(howmany(area->width + area->x - m_padding.left + 1, m_char_width),
+                      m_column_count);
        if (col_stop <= col) {
                return;
        }
 
-       rect.x = col*width + terminal->pvt->padding.left;
-       rect.width = (col_stop - col) * width;
+       rect.x = col * m_char_width + m_padding.left;
+       rect.width = (col_stop - col) * m_char_width;
 
-       rect.y = terminal->pvt->row_to_pixel(row) + terminal->pvt->padding.top;
-       rect.height = (row_stop - row)*height;
+       rect.y = row_to_pixel(row) + m_padding.top;
+       rect.height = (row_stop - row) * m_char_height;
 
        /* the rect must be cell aligned to avoid overlapping XY bands */
        cairo_region_union_rectangle(region, &rect);
 
        _vte_debug_print (VTE_DEBUG_UPDATES,
-                       "vte_terminal_expand_region"
+                       "expand_cairo_region"
                        "       (%d,%d)x(%d,%d) pixels,"
-                       " (%d,%d)x(%d,%d) cells"
+                       " (%ld,%ld)x(%ld,%ld) cells"
                        " [(%d,%d)x(%d,%d) pixels]\n",
                        area->x, area->y, area->width, area->height,
                        col, row, col_stop - col, row_stop - row,
@@ -9899,7 +9897,7 @@ VteTerminalPrivate::widget_draw(cairo_t *cr)
                        cairo_region_t *rr = cairo_region_create ();
                        /* convert pixels into whole cells */
                        for (n = 0; n < n_rectangles; n++) {
-                               vte_terminal_expand_region (m_terminal, rr, rectangles + n);
+                               expand_cairo_region(rr, rectangles + n);
                        }
                        g_free (rectangles);
 
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 344e38d..9411079 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -524,6 +524,9 @@ public:
 
         void widget_settings_notify();
 
+        void expand_cairo_region(cairo_region_t *region,
+                                 GdkRectangle const* area) const;
+
         bool autoscroll();
         void start_autoscroll();
         void stop_autoscroll();


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