From 940cf6544b06718335695cc42027b8966dc3037b Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 03 Apr 2008 15:31:55 +0000 Subject: #5474: Scale emblems (rwh) --- (limited to 'sugar/graphics') 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) -- cgit v0.9.1