[gimp/gimp-2-10] app: fix some glitches in the splash status text.



commit 951e7d8e034ec58afa6f04ea4b4528c49d7682d6
Author: Jehan <jehan girinstud io>
Date:   Sun Oct 25 00:00:05 2020 +0200

    app: fix some glitches in the splash status text.
    
    These small glitches have bothered me for a while now, so I finally
    fixed these before the dev release!
    Basically there were 2 fixes:
    1. use the ink extents to compute any drawn area as this is what will be
       actually drawn.
    2. Not only expose the drawn area of the new text, but also the one of
       the previous text in order to be sure all text pixels are correctly
       reset (in case the new text is smaller than previous one). I.e. we
       must expose the smallest rectangle containing both previous and new
       area of text.
    
    (cherry picked from commit 3a50e52ac77ef377fcf060fb9548b0c2d619f392)

 app/gui/splash.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/app/gui/splash.c b/app/gui/splash.c
index 1499af760a..e25c1b0bc6 100644
--- a/app/gui/splash.c
+++ b/app/gui/splash.c
@@ -243,7 +243,8 @@ splash_update (const gchar *text1,
                const gchar *text2,
                gdouble      percentage)
 {
-  GdkRectangle expose = { 0, 0, 0, 0 };
+  static GdkRectangle prev_expose = { 0, 0, 0, 0 };
+  GdkRectangle        expose      = { 0, 0, 0, 0 };
 
   g_return_if_fail (percentage >= 0.0 && percentage <= 1.0);
 
@@ -251,12 +252,15 @@ splash_update (const gchar *text1,
     return;
 
   splash_position_layouts (splash, text1, text2, &expose);
+  gdk_rectangle_union (&expose, &prev_expose, &expose);
 
   if (expose.width > 0 && expose.height > 0)
     gtk_widget_queue_draw_area (splash->area,
                                 expose.x, expose.y,
                                 expose.width, expose.height);
 
+  prev_expose = expose;
+
   if ((text1 == NULL || ! g_strcmp0 (text1, splash->text1)) &&
       (text2 == NULL || ! g_strcmp0 (text2, splash->text2)) &&
       percentage == splash->percentage)
@@ -324,9 +328,7 @@ splash_position_layouts (GimpSplash   *splash,
                          GdkRectangle *area)
 {
   PangoRectangle  upper_ink;
-  PangoRectangle  upper_logical;
   PangoRectangle  lower_ink;
-  PangoRectangle  lower_logical;
   gint            text_height = 0;
 
   if (text1)
@@ -339,10 +341,10 @@ splash_position_layouts (GimpSplash   *splash,
 
       pango_layout_set_text (splash->upper, text1, -1);
       pango_layout_get_pixel_extents (splash->upper,
-                                      &upper_ink, &upper_logical);
+                                      &upper_ink, NULL);
 
-      splash->upper_x = (splash->width - upper_logical.width) / 2;
-      text_height += upper_logical.height;
+      splash->upper_x = (splash->width - upper_ink.width) / 2;
+      text_height += upper_ink.height;
     }
 
   if (text2)
@@ -355,10 +357,10 @@ splash_position_layouts (GimpSplash   *splash,
 
       pango_layout_set_text (splash->lower, text2, -1);
       pango_layout_get_pixel_extents (splash->lower,
-                                      &lower_ink, &lower_logical);
+                                      &lower_ink, NULL);
 
-      splash->lower_x = (splash->width - lower_logical.width) / 2;
-      text_height += lower_logical.height;
+      splash->lower_x = (splash->width - lower_ink.width) / 2;
+      text_height += lower_ink.height;
     }
 
   /* For pretty printing, let's say we want at least double space. */
@@ -378,7 +380,7 @@ splash_position_layouts (GimpSplash   *splash,
     {
       splash->upper_y = MIN (splash->height - text_height,
                              splash->height * 13 / 16 -
-                             upper_logical.height / 2);
+                             upper_ink.height / 2);
 
       if (area)
         splash_rectangle_union (area, &upper_ink,
@@ -388,7 +390,7 @@ splash_position_layouts (GimpSplash   *splash,
   if (text2)
     {
       splash->lower_y = ((splash->height + splash->upper_y) / 2 -
-                         lower_logical.height / 2);
+                         lower_ink.height / 2);
 
       if (area)
         splash_rectangle_union (area, &lower_ink,


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