[gnome-control-center] user-accounts: change default size for avatar cropping



commit 33052abe9c3db34c502d7f28938d169a2f540247
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Nov 10 09:35:21 2014 +0100

    user-accounts: change default size for avatar cropping
    
    Change default size for avatar cropping to correspond with changes in cheese.
    The default size should be based on maximal size of the image instead of
    minimal size for cropping.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739871

 panels/user-accounts/cc-crop-area.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/panels/user-accounts/cc-crop-area.c b/panels/user-accounts/cc-crop-area.c
index 1b6e407..4d04f55 100644
--- a/panels/user-accounts/cc-crop-area.c
+++ b/panels/user-accounts/cc-crop-area.c
@@ -145,8 +145,17 @@ update_pixbufs (CcCropArea *area)
                 shift_colors (area->priv->color_shifted, -32, -32, -32, 0);
 
                 if (area->priv->scale == 0.0) {
-                        area->priv->crop.width = 2 * area->priv->base_width / scale;
-                        area->priv->crop.height = 2 * area->priv->base_height / scale;
+                        gdouble scale_to_80, scale_to_image, crop_scale;
+
+                        /* Scale the crop rectangle to 80% of the area, or less to fit the image */
+                        scale_to_80 = MIN ((gdouble)gdk_pixbuf_get_width (area->priv->pixbuf) * 0.8 / 
area->priv->base_width,
+                                           (gdouble)gdk_pixbuf_get_height (area->priv->pixbuf) * 0.8 / 
area->priv->base_height);
+                        scale_to_image = MIN ((gdouble)dest_width / area->priv->base_width,
+                                              (gdouble)dest_height / area->priv->base_height);
+                        crop_scale = MIN (scale_to_80, scale_to_image);
+
+                        area->priv->crop.width = crop_scale * area->priv->base_width / scale;
+                        area->priv->crop.height = crop_scale * area->priv->base_height / scale;
                         area->priv->crop.x = (gdk_pixbuf_get_width (area->priv->browse_pixbuf) - 
area->priv->crop.width) / 2;
                         area->priv->crop.y = (gdk_pixbuf_get_height (area->priv->browse_pixbuf) - 
area->priv->crop.height) / 2;
                 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]