don't rescale image when size is < 1

This commit is contained in:
Yann Leboulanger 2006-04-07 19:03:38 +00:00
parent c0bcd072c0
commit 30f7f7bea8
1 changed files with 3 additions and 1 deletions

View File

@ -401,13 +401,15 @@ def _get_fade_color(treeview, selected, focused):
int(bg.blue*p + fg.blue*q)) int(bg.blue*p + fg.blue*q))
def get_scaled_pixbuf(pixbuf, kind): def get_scaled_pixbuf(pixbuf, kind):
'''returns scaled pixbuf, keeping ratio etc '''returns scaled pixbuf, keeping ratio etc or None
kind is either "chat" or "roster" or "notification" or "tooltip"''' kind is either "chat" or "roster" or "notification" or "tooltip"'''
# resize to a width / height for the avatar not to have distortion # resize to a width / height for the avatar not to have distortion
# (keep aspect ratio) # (keep aspect ratio)
width = gajim.config.get(kind + '_avatar_width') width = gajim.config.get(kind + '_avatar_width')
height = gajim.config.get(kind + '_avatar_height') height = gajim.config.get(kind + '_avatar_height')
if width < 1 or height < 1:
return None
# Pixbuf size # Pixbuf size
pix_width = pixbuf.get_width() pix_width = pixbuf.get_width()