[pango/matthiasc/for-master: 4/5] layout: Fix a small optimization




commit e4682685c90ca099a8983a51b540ee5604968200
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 4 11:49:10 2021 -0400

    layout: Fix a small optimization
    
    pango_layout_set_width was trying to avoid invalidating
    lines in some cases, but it failed.

 pango/pango-layout.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 1f86150e..89badecc 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -355,10 +355,12 @@ pango_layout_set_width (PangoLayout *layout,
 
   if (width != layout->width)
     {
+      int old_width = layout->width;
+
       layout->width = width;
 
       /* Increasing the width can only decrease the line count */
-      if (layout->line_count == 1 && width > layout->width)
+      if (layout->line_count == 1 && width > old_width)
         return;
 
       layout_changed (layout);


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