From f153fc4ad4a09a31c5df22f67931d052f0a30385 Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Fri, 3 May 2013 15:50:44 -0500 Subject: Begin to work on bug #50 --- capplets/about-me/mate-about-me.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'capplets') diff --git a/capplets/about-me/mate-about-me.c b/capplets/about-me/mate-about-me.c index b48cbdee..22bb2f14 100644 --- a/capplets/about-me/mate-about-me.c +++ b/capplets/about-me/mate-about-me.c @@ -138,7 +138,8 @@ about_me_update_photo (MateAboutMe *me) GdkPixbuf *pixbuf = NULL, *scaled = NULL; int height, width; gboolean do_scale = FALSE; - float scale; + float scale = 1.0; + float scalex = 1.0, scaley = 1.0; e_image_chooser_get_image_data (E_IMAGE_CHOOSER (me->image_chooser), (char **) &data, &length); @@ -158,11 +159,18 @@ about_me_update_photo (MateAboutMe *me) height = gdk_pixbuf_get_height (pixbuf); width = gdk_pixbuf_get_width (pixbuf); - if (height >= width && height > MAX_HEIGHT) { - scale = (float)MAX_HEIGHT/height; + if (width > MAX_WIDTH) { + scalex = (float)MAX_WIDTH/width; + if (scalex < scale) { + scale = scalex; + } do_scale = TRUE; - } else if (width > height && width > MAX_WIDTH) { - scale = (float)MAX_WIDTH/width; + } + if (height > MAX_HEIGHT) { + scaley = (float)MAX_HEIGHT/height; + if (scaley < scale) { + scale = scaley; + } do_scale = TRUE; } -- cgit v1.2.1