[gnome-boxes] Make paused screenshot nicer



commit bd09f306a3831ce0466b529df295c82ba8d9ae90
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 28 18:58:36 2012 +0200

    Make paused screenshot nicer
    
    We use ADD instead of over so that the rectangle pattern is more visible
    on a dark thumbnail too.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678455

 data/icons/Makefile.am    |    1 -
 data/icons/boxes-grid.png |  Bin 202 -> 0 bytes
 src/machine.vala          |   19 ++++++++++++++-----
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index b9b89f4..57e101b 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -37,7 +37,6 @@ endif
 imagesdir = $(datadir)/gnome-boxes/pixmaps
 images_DATA =					\
 	boxes-create.png			\
-	boxes-grid.png				\
 	$(LOGOS)				\
 	$(NULL)
 
diff --git a/src/machine.vala b/src/machine.vala
index b75d0e8..54e285b 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -97,7 +97,17 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     }
 
     static construct {
-        grid_surface = new Cairo.ImageSurface.from_png (get_pixmap ("boxes-grid.png"));
+        grid_surface = new Cairo.ImageSurface (Cairo.Format.A8, 2, 2);
+        var cr = new Cairo.Context (grid_surface);
+        cr.set_source_rgba (0, 0, 0, 0);
+        cr.paint ();
+
+        cr.set_source_rgba (1, 1, 1, 1);
+        cr.set_operator (Cairo.Operator.SOURCE);
+        cr.rectangle (0, 0, 1, 1);
+        cr.fill ();
+        cr.rectangle (1, 1, 1, 1);
+        cr.fill ();
     }
 
     public Machine (Boxes.CollectionSource source, string name) {
@@ -247,12 +257,11 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             context.set_operator (Cairo.Operator.HSL_SATURATION);
             context.paint ();
 
-            context.identity_matrix ();
-            context.scale (0.1875 / SCREENSHOT_WIDTH * width, 0.1875 / SCREENSHOT_HEIGHT * height);
+            context.scale (2.0, 2.0);
             var grid = new Cairo.Pattern.for_surface (grid_surface);
             grid.set_extend (Cairo.Extend.REPEAT);
-            context.set_source_rgba (0, 0, 0, 1);
-            context.set_operator (Cairo.Operator.OVER);
+            context.set_source_rgba (0.2, 0.2, 0.2, 1);
+            context.set_operator (Cairo.Operator.ADD);
             context.mask (grid);
         }
 



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