[gegl] buffer: add fast path for nearest neighbour in gegl_buffer_sample



commit 50c72661cef6970587c7d30a471e094a2c690346
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Tue Mar 27 03:16:08 2012 +0100

    buffer: add fast path for nearest neighbour in gegl_buffer_sample
    
    Note that neither gegl_buffer_sample itself nor the new fast path are thread
    safe. This should ideally change.

 gegl/buffer/gegl-buffer-access.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index a033e86..df0e6fc 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1109,6 +1109,13 @@ gegl_buffer_sample (GeglBuffer       *buffer,
   if (!format)
     format = buffer->soft_format;
 
+  if (format == buffer->soft_format &&
+      sampler_type == GEGL_SAMPLER_NEAREST)
+    {
+      /* XXX: not thread safe */
+      gegl_buffer_get_pixel (buffer, x, y, format, dest);
+      return;
+    }
   /* unset the cached sampler if it dosn't match the needs */
   if (buffer->sampler != NULL &&
      (!G_TYPE_CHECK_INSTANCE_TYPE (buffer->sampler, desired_type) ||



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