[cheese] Set a reasonable default size for avatar cropping



commit c605ad3578ff66452bd7b01d257f31c64e7905ef
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Oct 25 13:21:32 2013 +0200

    Set a reasonable default size for avatar cropping
    
    The default is based on the minimum 48x48 size. Instead we should be
    cropping to nearly the maximum size of the image, which would still show
    the crop handles but would not discard most of the captured image.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710874

 libcheese/um-crop-area.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libcheese/um-crop-area.c b/libcheese/um-crop-area.c
index 3e1fdde..02c9887 100644
--- a/libcheese/um-crop-area.c
+++ b/libcheese/um-crop-area.c
@@ -182,8 +182,12 @@ update_pixbufs (UmCropArea *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 crop_scale;
+
+                        crop_scale = MIN (gdk_pixbuf_get_width (area->priv->pixbuf) / area->priv->base_width 
* 0.8,
+                                          gdk_pixbuf_get_height (area->priv->pixbuf) / 
area->priv->base_height * 0.8);
+                        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]