[gnome-control-center/wip/exalm/appearance-thumbnails] background-paintable: Clip light wallpapers as well




commit eca4c0a370b0e17665f69f9cdc1ee8f84a6e18ab
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Feb 10 05:11:30 2022 +0500

    background-paintable: Clip light wallpapers as well
    
    Turns out drawing the whole light wallpaper and then half of the dark
    wallpaper on top of it is leading to a case of
    https://gitlab.gnome.org/GNOME/gtk/-/issues/3840
    
    Draw half of each instead, so they don't overlap.

 panels/background/cc-background-paintable.c | 34 ++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/panels/background/cc-background-paintable.c b/panels/background/cc-background-paintable.c
index 763370601..e5107364d 100644
--- a/panels/background/cc-background-paintable.c
+++ b/panels/background/cc-background-paintable.c
@@ -240,23 +240,31 @@ cc_background_paintable_snapshot (GdkPaintable *paintable,
                                   double        height)
 {
   CcBackgroundPaintable *self = CC_BACKGROUND_PAINTABLE (paintable);
+  gboolean is_rtl;
 
-  gdk_paintable_snapshot (self->texture, snapshot, width, height);
-
-  if (self->dark_texture)
+  if (!self->dark_texture)
     {
-      gboolean is_rtl = self->text_direction == GTK_TEXT_DIR_RTL;
-
-      gtk_snapshot_push_clip (GTK_SNAPSHOT (snapshot),
-                              &GRAPHENE_RECT_INIT (is_rtl ? 0.0f : width / 2.0f,
-                                                   0.0f,
-                                                   width / 2.0f,
-                                                   height));
+      gdk_paintable_snapshot (self->texture, snapshot, width, height);
+      return;
+    }
 
-      gdk_paintable_snapshot (self->dark_texture, snapshot, width, height);
+  is_rtl = self->text_direction == GTK_TEXT_DIR_RTL;
 
-      gtk_snapshot_pop (GTK_SNAPSHOT (snapshot));
-    }
+  gtk_snapshot_push_clip (GTK_SNAPSHOT (snapshot),
+                          &GRAPHENE_RECT_INIT (is_rtl ? width / 2.0f : 0.0f,
+                                               0.0f,
+                                               width / 2.0f,
+                                               height));
+  gdk_paintable_snapshot (self->texture, snapshot, width, height);
+  gtk_snapshot_pop (GTK_SNAPSHOT (snapshot));
+
+  gtk_snapshot_push_clip (GTK_SNAPSHOT (snapshot),
+                          &GRAPHENE_RECT_INIT (is_rtl ? 0.0f : width / 2.0f,
+                                               0.0f,
+                                               width / 2.0f,
+                                               height));
+  gdk_paintable_snapshot (self->dark_texture, snapshot, width, height);
+  gtk_snapshot_pop (GTK_SNAPSHOT (snapshot));
 }
 
 static int


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