Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-09-02 21:51:01 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-09-02 21:51:01 (GMT)
commit044afe4ae8822c7e64113d8e7d016352cd457665 (patch)
tree65617094d175c512584f514bc074d8cd84281d7d /sugar
parent94e136c3c3f4701b493dce544f10628ae5392b83 (diff)
Expand icon bbox when there is a badge.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/graphics/icon.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/sugar/graphics/icon.py b/sugar/graphics/icon.py
index c710f1a..31af35b 100644
--- a/sugar/graphics/icon.py
+++ b/sugar/graphics/icon.py
@@ -202,13 +202,13 @@ class _IconBuffer(object):
context.set_source_surface(surface, 0, 0)
context.paint()
- def _get_size(self, icon_width, icon_height):
+ def _get_size(self, icon_width, icon_height, padding):
if self.width is not None and self.height is not None:
- width = self.width
- height = self.height
+ width = self.width + padding
+ height = self.height + padding
else:
- width = icon_width
- height = icon_height
+ width = icon_width + padding
+ height = icon_height + padding
return width, height
@@ -254,11 +254,11 @@ class _IconBuffer(object):
badge_info = self._get_badge_info(icon_info, icon_width, icon_height)
- width, height = self._get_size(icon_width, icon_height)
+ padding = badge_info.icon_padding
+ width, height = self._get_size(icon_width, icon_height, padding)
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
context = cairo.Context(surface)
- padding = badge_info.icon_padding
context.scale(float(width) / (icon_width + padding * 2),
float(height) / (icon_height + padding * 2))
context.save()