[gimp] app: fix gimp_display_shell_untransform_viewport() ...



commit 3183b894df2362380f3b42afc6d9c421fea8f396
Author: Ell <ell_se yahoo com>
Date:   Tue Jul 19 10:29:32 2016 +0000

    app: fix gimp_display_shell_untransform_viewport() ...
    
    ... when the canvas is rotated.
    
    Use gimp_display_shell_untransform_bounds() instead of transforming
    the two endpoints independently.

 app/display/gimpdisplayshell-transform.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-transform.c b/app/display/gimpdisplayshell-transform.c
index d63f4d0..704bdd1 100644
--- a/app/display/gimpdisplayshell-transform.c
+++ b/app/display/gimpdisplayshell-transform.c
@@ -17,6 +17,8 @@
 
 #include "config.h"
 
+#include <math.h>
+
 #include <gegl.h>
 #include <gtk/gtk.h>
 
@@ -870,18 +872,20 @@ gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
                                          gint             *height)
 {
   GimpImage *image;
-  gint       x1, y1, x2, y2;
+  gdouble    x1, y1, x2, y2;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
-  gimp_display_shell_untransform_xy (shell,
-                                     0, 0,
-                                     &x1, &y1,
-                                     FALSE);
-  gimp_display_shell_untransform_xy (shell,
-                                     shell->disp_width, shell->disp_height,
-                                     &x2, &y2,
-                                     FALSE);
+  gimp_display_shell_untransform_bounds (shell,
+                                         0, 0,
+                                         shell->disp_width, shell->disp_height,
+                                         &x1, &y1,
+                                         &x2, &y2);
+
+  x1 = floor (x1);
+  y1 = floor (y1);
+  x2 = ceil (x2);
+  y2 = ceil (y2);
 
   image = gimp_display_get_image (shell->display);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]