Revision: 1732
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1732&view=rev
Author:   nadvornik
Date:     2009-06-06 17:28:16 +0000 (Sat, 06 Jun 2009)

Log Message:
-----------
swap x and y scale when scaling rotated images - it fixes tiles that were
sometimes off by 1 pixel - thanks Petr for reporting,
code cleanup

Modified Paths:
--------------
    trunk/src/pixbuf-renderer.c

Modified: trunk/src/pixbuf-renderer.c
===================================================================
--- trunk/src/pixbuf-renderer.c 2009-06-06 17:02:21 UTC (rev 1731)
+++ trunk/src/pixbuf-renderer.c 2009-06-06 17:28:16 UTC (rev 1732)
@@ -2122,7 +2122,7 @@
 
 static void pr_tile_coords_map_orientation(PixbufRenderer *pr,
                                     gdouble tile_x, gdouble tile_y, /* 
coordinates of the tile */
-                                    gint image_w, gint image_h,
+                                    gdouble image_w, gdouble image_h,
                                     gdouble tile_w, gdouble tile_h,
                                     gdouble *res_x, gdouble *res_y)
 {
@@ -2651,15 +2651,30 @@
                scale_x = (gdouble)pr->width / pr->image_width;
                scale_y = (gdouble)pr->height / pr->image_height;
 
-               pr_tile_coords_map_orientation(pr, it->x / scale_x, it->y 
/scale_y ,
-                                           pr->image_width, pr->image_height,
-                                           pr->tile_width / scale_x , 
pr->tile_height / scale_y,
+               pr_tile_coords_map_orientation(pr, it->x, it->y,
+                                           pr->image_width * scale_x, 
pr->image_height * scale_y,
+                                           pr->tile_width, pr->tile_height,
                                            &src_x, &src_y);
                pr_tile_region_map_orientation(pr, x, y,
                                            pr->tile_width, pr->tile_height,
                                            w, h,
                                            &pb_x, &pb_y,
                                            &pb_w, &pb_h);
+               switch (pr->orientation)
+                       {
+                       gdouble tmp;
+                       case EXIF_ORIENTATION_LEFT_TOP:
+                       case EXIF_ORIENTATION_RIGHT_TOP:
+                       case EXIF_ORIENTATION_RIGHT_BOTTOM:
+                       case EXIF_ORIENTATION_LEFT_BOTTOM:
+                               tmp = scale_x;
+                               scale_x = scale_y;
+                               scale_y = tmp;
+                               break;
+                       default:
+                               /* nothing to do */
+                               break;
+                       }
 
                /* HACK: The pixbuf scalers get kinda buggy(crash) with 
extremely
                 * small sizes for anything but GDK_INTERP_NEAREST
@@ -2669,16 +2684,16 @@
                if (!has_alpha)
                        {
                        gdk_pixbuf_scale(pr->pixbuf, it->pixbuf, pb_x, pb_y, 
pb_w, pb_h,
-                                        (gdouble) 0.0 - src_x * scale_x,
-                                        (gdouble) 0.0 - src_y * scale_y,
+                                        (gdouble) 0.0 - src_x,
+                                        (gdouble) 0.0 - src_y,
                                         scale_x, scale_y,
                                         (fast) ? GDK_INTERP_NEAREST : 
pr->zoom_quality);
                        }
                else
                        {
                        gdk_pixbuf_composite_color(pr->pixbuf, it->pixbuf, 
pb_x, pb_y, pb_w, pb_h,
-                                        (gdouble) 0.0 - src_x * scale_x,
-                                        (gdouble) 0.0 - src_y * scale_y,
+                                        (gdouble) 0.0 - src_x,
+                                        (gdouble) 0.0 - src_y,
                                         scale_x, scale_y,
                                         (fast) ? GDK_INTERP_NEAREST : 
pr->zoom_quality,
                                         255, it->x + pb_x, it->y + pb_y,


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to