From 940cf6544b06718335695cc42027b8966dc3037b Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 3 Apr 2008 17:31:55 +0200 Subject: [PATCH] #5474: Scale emblems (rwh) --- sugar/graphics/icon.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sugar/graphics/icon.py b/sugar/graphics/icon.py index 9a96fa06..213b3bc4 100644 --- a/sugar/graphics/icon.py +++ b/sugar/graphics/icon.py @@ -147,10 +147,21 @@ class _IconBuffer(object): badge_file_name = badge_info.get_filename() if badge_file_name.endswith('.svg'): handle = self._loader.load(badge_file_name, {}, self.cache) + + dimensions = handle.get_dimension_data() + icon_width = int(dimensions[0]) + icon_height = int(dimensions[1]) + pixbuf = handle.get_pixbuf() else: pixbuf = gtk.gdk.pixbuf_new_from_file(badge_file_name) + icon_width = pixbuf.get_width() + icon_height = pixbuf.get_height() + + context.scale(float(size) / icon_width, + float(size) / icon_height) + if not sensitive: pixbuf = self._get_insensitive_pixbuf(pixbuf, widget) surface = hippo.cairo_surface_from_gdk_pixbuf(pixbuf)