[Xfce4-commits] <ristretto:ristretto-0.3> Improve rendering-performance when closing a file.

Stephan Arts noreply at xfce.org
Wed Apr 18 22:38:03 CEST 2012


Updating branch refs/heads/ristretto-0.3
         to 37c8a8e6a798ae8c5e01236148b610bf64688ac3 (commit)
       from b26faa69ff81ecb3913691311018279936a677cc (commit)

commit 37c8a8e6a798ae8c5e01236148b610bf64688ac3
Author: Stephan Arts <stephan at xfce.org>
Date:   Wed Apr 18 22:35:24 2012 +0200

    Improve rendering-performance when closing a file.
    
     - Also, remove assertion-errors

 src/image_viewer.c |   37 ++++++++++++++-----------------------
 1 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/src/image_viewer.c b/src/image_viewer.c
index 46b1110..a8df4a8 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -881,6 +881,20 @@ correct_adjustments ( RsttoImageViewer *viewer )
     g_object_freeze_notify(G_OBJECT(viewer->hadjustment));
     g_object_freeze_notify(G_OBJECT(viewer->vadjustment));
 
+    /* Check if the image-size makes sense,
+     * if not, set the upper limits to 0.0
+     */
+    if ( (image_width < 1.0) || (image_height < 1.0) )
+    {
+        gtk_adjustment_set_upper (
+                viewer->hadjustment,
+                0.0 );
+        gtk_adjustment_set_upper (
+                viewer->vadjustment,
+                0.0 );
+        return;
+    }
+
     switch (viewer->priv->orientation)
     {
         case RSTTO_IMAGE_ORIENT_NONE:
@@ -1477,29 +1491,6 @@ rstto_image_viewer_set_file (
             /* Reset the image-size to 0.0 */
             viewer->priv->image_height = 0.0;
             viewer->priv->image_width = 0.0;
-
-            g_object_freeze_notify(G_OBJECT(viewer->hadjustment));
-            g_object_freeze_notify(G_OBJECT(viewer->vadjustment));
-
-            gtk_adjustment_set_upper (
-                    viewer->hadjustment,
-                    0.0);
-            gtk_adjustment_set_value (
-                    viewer->hadjustment,
-                    0.0);
-
-            gtk_adjustment_set_upper (
-                    viewer->vadjustment,
-                    0.0);
-            gtk_adjustment_set_value (
-                    viewer->vadjustment,
-                    0.0);
-
-            /*
-             * Enable signals on the adjustments.
-             */
-            g_object_thaw_notify(G_OBJECT(viewer->vadjustment));
-            g_object_thaw_notify(G_OBJECT(viewer->hadjustment));
             
             gdk_window_invalidate_rect (
                     widget->window,


More information about the Xfce4-commits mailing list