[gnome-games] game-thumbnail: Stop using Gdk.cairo_surface_create_from_pixbuf()



commit 24dc0ad142df3db4bab9c4547005d2d58ee9f049
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Aug 19 20:53:09 2019 +0500

    game-thumbnail: Stop using Gdk.cairo_surface_create_from_pixbuf()
    
    Use Gtk.cairo_set_source_pixbuf() instead. Also, remove the now unused
    'window' field.

 src/ui/game-thumbnail.vala | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/ui/game-thumbnail.vala b/src/ui/game-thumbnail.vala
index 3f53698d..12009012 100644
--- a/src/ui/game-thumbnail.vala
+++ b/src/ui/game-thumbnail.vala
@@ -60,7 +60,6 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
 
        public struct DrawingContext {
                Cairo.Context cr;
-               Gdk.Window? window;
                Gtk.StyleContext style;
                Gtk.StateFlags state;
                int width;
@@ -80,14 +79,13 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
        }
 
        public override bool draw (Cairo.Context cr) {
-               var window = get_window ();
                var style = get_style_context ();
                var state = get_state_flags ();
                var width = get_allocated_width ();
                var height = get_allocated_height ();
 
                DrawingContext context = {
-                       cr, window, style, state, width, height
+                       cr, style, state, width, height
                };
 
                if (icon == null)
@@ -305,8 +303,6 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
        }
 
        private void draw_pixbuf (DrawingContext context, Gdk.Pixbuf pixbuf) {
-               var surface = Gdk.cairo_surface_create_from_pixbuf (pixbuf, 1, context.window);
-
                context.cr.save ();
                context.cr.scale (1.0 / scale_factor, 1.0 / scale_factor);
 
@@ -315,7 +311,7 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
                var x_offset = (context.width * scale_factor - pixbuf.width) / 2;
                var y_offset = (context.height * scale_factor - pixbuf.height) / 2;
 
-               context.cr.set_source_surface (surface, x_offset, y_offset);
+               Gdk.cairo_set_source_pixbuf (context.cr, pixbuf, x_offset, y_offset);
                context.cr.mask_surface (mask, 0, 0);
 
                context.cr.restore ();


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