diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2008-04-03 15:31:55 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2008-04-03 15:31:55 (GMT) |
commit | 940cf6544b06718335695cc42027b8966dc3037b (patch) | |
tree | 2a74de6d06ced803aa048c712b211a0ba816fe22 | |
parent | 905fd3381073c639aa4f743b364022911f103009 (diff) |
#5474: Scale emblems (rwh)
-rw-r--r-- | sugar/graphics/icon.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sugar/graphics/icon.py b/sugar/graphics/icon.py index 9a96fa0..213b3bc 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) |