[gegl] transform-core: fix rounding and types in buffer shift no-op translation



commit 9442052789a2f9c8b8525ccf9579dce756fcbf58
Author: Nicolas Robidoux <nrobidoux git gnome org>
Date:   Sun Nov 25 12:12:55 2012 -0500

    transform-core: fix rounding and types in buffer shift no-op translation

 operations/transform/transform-core.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 30ade65..95e7475 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -975,17 +975,19 @@ gegl_transform_process (GeglOperation        *operation,
            (gegl_matrix3_is_translate (&matrix) &&
             ! strcmp (transform->filter, "nearest")))
     {
-      /* doing a buffer shifting trick, (enhanced nop) */
+      /*
+       * Buffer shifting trick (enhanced nop).
+       */
       input  = gegl_operation_context_get_source (context, "input");
 
-      output = g_object_new (GEGL_TYPE_BUFFER,
-                             "source",    input,
-                             "shift-x",   (int)-matrix.coeff[0][2],
-                             "shift-y",   (int)-matrix.coeff[1][2],
-                             "abyss-width", -1,  /* turn of abyss
-                                                    (relying on abyss
-                                                    of source) */
-                         NULL);
+      output =
+	g_object_new (GEGL_TYPE_BUFFER,
+		      "source",      input,
+		      "shift-x",     -(gint) round((double) matrix.coeff[0][2]),
+		      "shift-y",     -(gint) round((double) matrix.coeff[1][2]),
+		      "abyss-width", -1, /* turn off abyss (relying on
+					    abyss of source) */
+		      NULL);
 
       if (gegl_object_get_has_forked (input))
         gegl_object_set_has_forked (output);



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