Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sugar/graphics/icon.py11
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)