Updating branch refs/heads/master
         to 732e266d7990d2cdc15b8aba4885c34df1934836 (commit)
       from eee4f7cd4dba7b813f23bb03772893d0722dcac6 (commit)

commit 732e266d7990d2cdc15b8aba4885c34df1934836
Author: Stephan Arts <[email protected]>
Date:   Fri Jul 29 20:17:53 2011 +0200

    When creating a subpixbuf smaller then the image-size, add 1 to make it fit 
the window.

 src/image_viewer.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/image_viewer.c b/src/image_viewer.c
index b3dee92..e4aca47 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -1243,14 +1243,23 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer 
*viewer)
         if (gtk_adjustment_get_page_size (viewer->vadjustment) > 0)
         {
 
+            /*
+             * Converting a double to an integer will result in 
rounding-errors,
+             * everything behind the point will be cut off, this results in an 
+             * image that won't fit nicely in the window.
+             *
+             * This will look like bg-color borders around the image.
+             * Adding '1' when the tmp_pixbuf is smaller then the full width or
+             * height of the image solves this.
+             */
             GdkPixbuf *tmp_pixbuf = gdk_pixbuf_new_subpixbuf 
(viewer->priv->pixbuf,
                     (gint)(gtk_adjustment_get_value (viewer->hadjustment) / 
relative_scale),
                     (gint)(gtk_adjustment_get_value (viewer->vadjustment) / 
relative_scale),
                     (gint)((gtk_adjustment_get_page_size (viewer->hadjustment) 
/ relative_scale) < width)?
-                           (gtk_adjustment_get_page_size (viewer->hadjustment) 
/ relative_scale):
+                           (gtk_adjustment_get_page_size (viewer->hadjustment) 
/ relative_scale)+1:
                            (width),
                     (gint)((gtk_adjustment_get_page_size (viewer->vadjustment) 
/ relative_scale) < height)?
-                           (gtk_adjustment_get_page_size (viewer->vadjustment) 
/ relative_scale):
+                           (gtk_adjustment_get_page_size (viewer->vadjustment) 
/ relative_scale)+1:
                            (height));
 
             if (viewer->priv->dst_pixbuf)
_______________________________________________
Xfce4-commits mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to