[Xfce4-commits] <ristretto:ristretto-0.0> Do not scale the image UP, only DOWN Fix warning if thumbnail does not exist

Stephan Arts noreply at xfce.org
Sun Oct 23 19:13:00 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to 415eea3428c67d8bc2ae097c451a3d2ea001d307 (commit)
       from 97ee4a1faf585e0386bcf05cc64c092fb3ebb5d3 (commit)

commit 415eea3428c67d8bc2ae097c451a3d2ea001d307
Author: Stephan Arts <stephan at xfce.org>
Date:   Tue Apr 28 00:26:34 2009 +0200

    Do not scale the image UP, only DOWN
    Fix warning if thumbnail does not exist

 src/image.c          |    4 ++--
 src/picture_viewer.c |    7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/image.c b/src/image.c
index f3ff26d..098aa6a 100644
--- a/src/image.c
+++ b/src/image.c
@@ -637,8 +637,8 @@ cb_rstto_image_size_prepared (GdkPixbufLoader *loader, gint width, gint height,
     if (image->priv->max_size > 0)
     {
         gdouble ratio = (gdouble)(image->priv->max_size*1000000)/(gdouble)(width * height);
-
-    	gdk_pixbuf_loader_set_size (loader, width*ratio, height*ratio);
+        if (ratio < 0)
+    	    gdk_pixbuf_loader_set_size (loader, width*ratio, height*ratio);
     }
 }
 
diff --git a/src/picture_viewer.c b/src/picture_viewer.c
index 912122a..c92582a 100644
--- a/src/picture_viewer.c
+++ b/src/picture_viewer.c
@@ -975,8 +975,11 @@ cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer)
                 {
                     case RSTTO_PICTURE_VIEWER_STATE_PREVIEW:
                         p_src_pixbuf = rstto_image_get_thumbnail (viewer->priv->image);
-                        thumb_width = (gdouble)gdk_pixbuf_get_width (p_src_pixbuf);
-                        thumb_scale = (thumb_width / image_width);
+                        if (p_src_pixbuf)
+                        {
+                            thumb_width = (gdouble)gdk_pixbuf_get_width (p_src_pixbuf);
+                            thumb_scale = (thumb_width / image_width);
+                        }
                         break;
                     default:
                         break;


More information about the Xfce4-commits mailing list