[gegl] buffers: minor improvment for gegl_buffer_sample in the _NEAREST case



commit 70bebe27fc85e2d1419fa5e7832cd1f10ac771ec
Author: Téo Mazars <teo mazars ensimag fr>
Date:   Sat Oct 19 07:04:37 2013 +0200

    buffers: minor improvment for gegl_buffer_sample in the _NEAREST case
    
    call gegl_sampler_gtype_from_enum() only if needed,
    actual speedup measured for the _NEAREST case: 1.2x

 gegl/buffer/gegl-buffer-access.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index a7d4b87..26e83c9 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1658,8 +1658,6 @@ gegl_buffer_sample (GeglBuffer       *buffer,
   return;
 #endif
 
-  desired_type = gegl_sampler_gtype_from_enum (sampler_type);
-
   if (!format)
     format = buffer->soft_format;
 
@@ -1670,6 +1668,9 @@ gegl_buffer_sample (GeglBuffer       *buffer,
       gegl_buffer_get_pixel (buffer, x, y, format, dest, repeat_mode);
       return;
     }
+
+  desired_type = gegl_sampler_gtype_from_enum (sampler_type);
+
   /* 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]