[gimp/gimp-2-10] app: fix switching filter-tool split-preview orientation



commit a215db1f12b591160ab00b8157004fde62587b59
Author: Ell <ell_se yahoo com>
Date:   Thu Jun 11 21:29:12 2020 +0300

    app: fix switching filter-tool split-preview orientation
    
    ... after last commit.
    
    (cherry picked from commit 93f728e484eddb461730bc8084c86a6d4ce79942)

 app/tools/gimpfilteroptions.c |  8 ++++----
 app/tools/gimpfilteroptions.h |  4 ++--
 app/tools/gimpfiltertool.c    | 12 ++++++------
 3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/app/tools/gimpfilteroptions.c b/app/tools/gimpfilteroptions.c
index fe2315b29e..9bded52639 100644
--- a/app/tools/gimpfilteroptions.c
+++ b/app/tools/gimpfilteroptions.c
@@ -234,11 +234,11 @@ gimp_filter_options_switch_preview_side (GimpFilterOptions *options)
 
 void
 gimp_filter_options_switch_preview_orientation (GimpFilterOptions *options,
-                                                gdouble            position_x,
-                                                gdouble            position_y)
+                                                gint               position_x,
+                                                gint               position_y)
 {
   GimpAlignmentType alignment;
-  gdouble           position;
+  gint              position;
 
   g_return_if_fail (GIMP_IS_FILTER_OPTIONS (options));
 
@@ -264,6 +264,6 @@ gimp_filter_options_switch_preview_orientation (GimpFilterOptions *options,
 
   g_object_set (options,
                 "preview-split-alignment", alignment,
-                "preview-split-position",  CLAMP (position, 0.0, 1.0),
+                "preview-split-position",  position,
                 NULL);
 }
diff --git a/app/tools/gimpfilteroptions.h b/app/tools/gimpfilteroptions.h
index 5ae9192ae1..7cd3b5fa26 100644
--- a/app/tools/gimpfilteroptions.h
+++ b/app/tools/gimpfilteroptions.h
@@ -56,8 +56,8 @@ GType   gimp_filter_options_get_type                   (void) G_GNUC_CONST;
 
 void    gimp_filter_options_switch_preview_side        (GimpFilterOptions *options);
 void    gimp_filter_options_switch_preview_orientation (GimpFilterOptions *options,
-                                                        gdouble            position_x,
-                                                        gdouble            position_y);
+                                                        gint               position_x,
+                                                        gint               position_y);
 
 
 #endif /* __GIMP_FILTER_OPTIONS_H__ */
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index 4577014771..e54aa514e4 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -490,13 +490,13 @@ gimp_filter_tool_button_press (GimpTool            *tool,
       else if (state & gimp_get_toggle_behavior_mask ())
         {
           GimpItem *item = GIMP_ITEM (tool->drawable);
-          gdouble   pos_x;
-          gdouble   pos_y;
+          gint      pos_x;
+          gint      pos_y;
 
-          pos_x = ((coords->x - gimp_item_get_offset_x (item)) /
-                   gimp_item_get_width (item));
-          pos_y = ((coords->y - gimp_item_get_offset_y (item)) /
-                   gimp_item_get_height (item));
+          pos_x = CLAMP (RINT (coords->x) - gimp_item_get_offset_x (item),
+                         0, gimp_item_get_width (item));
+          pos_y = CLAMP (RINT (coords->y) - gimp_item_get_offset_y (item),
+                         0, gimp_item_get_height (item));
 
           gimp_filter_options_switch_preview_orientation (options,
                                                           pos_x, pos_y);


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