[gimp] app: use different samplers for preview and commit in warp tool



commit 13b619c4743362b38f2e74c0ab954dd8da5ee0bd
Author: Ell <ell_se yahoo com>
Date:   Fri May 19 03:30:37 2017 -0400

    app: use different samplers for preview and commit in warp tool
    
    Use a fast nearest-neighbor sampler for the map-relative node
    during preview, and a slower cubic sampler when comitting/animating.

 app/tools/gimpwarptool.c |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 674a2b9..b8a1744 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -52,7 +52,9 @@
 #include "gimp-intl.h"
 
 
-#define STROKE_PERIOD 100
+#define STROKE_PERIOD   100
+#define PREVIEW_SAMPLER GEGL_SAMPLER_NEAREST
+#define COMMIT_SAMPLER  GEGL_SAMPLER_CUBIC
 
 
 static void       gimp_warp_tool_control            (GimpTool              *tool,
@@ -692,6 +694,13 @@ gimp_warp_tool_commit (GimpWarpTool *wt)
     {
       gimp_tool_control_push_preserve (tool->control, TRUE);
 
+      if (COMMIT_SAMPLER != PREVIEW_SAMPLER)
+        {
+          gegl_node_set (wt->render_node,
+                         "sampler-type", COMMIT_SAMPLER,
+                         NULL);
+        }
+
       gimp_drawable_filter_commit (wt->filter, GIMP_PROGRESS (tool), FALSE);
       g_object_unref (wt->filter);
       wt->filter = NULL;
@@ -747,8 +756,8 @@ gimp_warp_tool_create_graph (GimpWarpTool *wt)
                                NULL);
 
   render = gegl_node_new_child (graph,
-                                "operation", "gegl:map-relative",
-                                "sampler-type", GEGL_SAMPLER_LINEAR,
+                                "operation",    "gegl:map-relative",
+                                "sampler-type", PREVIEW_SAMPLER,
                                 NULL);
 
   gegl_node_connect_to (input,  "output",
@@ -771,6 +780,13 @@ gimp_warp_tool_create_filter (GimpWarpTool *wt,
   if (! wt->graph)
     gimp_warp_tool_create_graph (wt);
 
+  if (PREVIEW_SAMPLER != COMMIT_SAMPLER)
+    {
+      gegl_node_set (wt->render_node,
+                     "sampler-type", PREVIEW_SAMPLER,
+                     NULL);
+    }
+
   wt->filter = gimp_drawable_filter_new (drawable,
                                          _("Warp transform"),
                                          wt->graph,
@@ -935,6 +951,13 @@ gimp_warp_tool_animate (GimpWarpTool *wt)
       wt->filter = NULL;
     }
 
+  if (COMMIT_SAMPLER != PREVIEW_SAMPLER)
+    {
+      gegl_node_set (wt->render_node,
+                     "sampler-type", COMMIT_SAMPLER,
+                     NULL);
+    }
+
   gimp_progress_start (GIMP_PROGRESS (tool), FALSE,
                        _("Rendering Frame %d"), 1);
 


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