[gnome-chess] Stop using deprecated Rsvg.pixbuf_from_file_at_size
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] Stop using deprecated Rsvg.pixbuf_from_file_at_size
- Date: Mon, 14 Oct 2013 22:11:03 +0000 (UTC)
commit d6cd5fc6c9946f85d7ce7b5853c0f68867aa8a12
Author: Robert Ancell <robert ancell canonical com>
Date: Tue Oct 15 11:10:55 2013 +1300
Stop using deprecated Rsvg.pixbuf_from_file_at_size
src/gnome-chess.vala | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 9a08e1b..1f70559 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -315,17 +315,25 @@ public class Application : Gtk.Application
if (!Gtk.icon_size_lookup (Gtk.IconSize.DIALOG, out width, out height))
return;
- Gdk.Pixbuf pixbuf;
try
{
- pixbuf = Rsvg.pixbuf_from_file_at_size (filename, width, height);
+ var h = new Rsvg.Handle.from_file (filename);
+
+ var s = new Cairo.ImageSurface (Cairo.Format.ARGB32, width, height);
+ var c = new Cairo.Context (s);
+ var m = Cairo.Matrix.identity ();
+ m.scale ((double) width / h.width, (double) height / h.height);
+ c.set_matrix (m);
+ h.render_cairo (c);
+
+ var p = Gdk.pixbuf_get_from_surface (s, 0, 0, width, height);
+ image.set_from_pixbuf (p);
}
catch (Error e)
{
warning ("Failed to load image %s: %s", filename, e.message);
return;
}
- image.set_from_pixbuf (pixbuf);
}
enum PromotionTypeSelected
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]