[gegl] Get rid of function pointer in boxfilter



commit 28b94ebcadf44fea9a1baf10d1e25b3764739121
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sun Mar 9 13:33:52 2014 -0700

    Get rid of function pointer in boxfilter
    
    With the current logic it's an unnecessary complication.

 gegl/gegl-algorithms.c |   37 +++++++++++++------------------------
 1 files changed, 13 insertions(+), 24 deletions(-)
---
diff --git a/gegl/gegl-algorithms.c b/gegl/gegl-algorithms.c
index 9f1c9e4..d5a5959 100644
--- a/gegl/gegl-algorithms.c
+++ b/gegl/gegl-algorithms.c
@@ -94,37 +94,26 @@ void gegl_resample_boxfilter (guchar              *dest_buf,
                               gint                 d_rowstride)
 {
   const Babl *comp_type  = babl_format_get_type (format, 0);
-
-  void (*resample_boxfilter_func) (guchar              *dest_buf,
-                                   const guchar        *source_buf,
-                                   const GeglRectangle *dst_rect,
-                                   const GeglRectangle *src_rect,
-                                   gint                 s_rowstride,
-                                   gdouble              scale,
-                                   gint                 bpp,
-                                   gint                 d_rowstride) = NULL;
+  const gint bpp = babl_format_get_bytes_per_pixel (format);
 
   if (comp_type == babl_type ("u8"))
-    resample_boxfilter_func = gegl_resample_boxfilter_u8;
+    gegl_resample_boxfilter_u8 (dest_buf, source_buf, dst_rect, src_rect,
+                                s_rowstride, scale, bpp, d_rowstride);
   else if (comp_type == babl_type ("u16"))
-    resample_boxfilter_func = gegl_resample_boxfilter_u16;
+    gegl_resample_boxfilter_u16 (dest_buf, source_buf, dst_rect, src_rect,
+                                 s_rowstride, scale, bpp, d_rowstride);
   else if (comp_type == babl_type ("u32"))
-    resample_boxfilter_func = gegl_resample_boxfilter_u32;
+    gegl_resample_boxfilter_u32 (dest_buf, source_buf, dst_rect, src_rect,
+                                 s_rowstride, scale, bpp, d_rowstride);
   else if (comp_type == babl_type ("float"))
-    resample_boxfilter_func = gegl_resample_boxfilter_float;
+    gegl_resample_boxfilter_float (dest_buf, source_buf, dst_rect, src_rect,
+                                   s_rowstride, scale, bpp, d_rowstride);
   else if (comp_type == babl_type ("double"))
-    resample_boxfilter_func = gegl_resample_boxfilter_double;
+    gegl_resample_boxfilter_double (dest_buf, source_buf, dst_rect, src_rect,
+                                    s_rowstride, scale, bpp, d_rowstride);
   else
-    resample_boxfilter_func = gegl_resample_nearest;
-
-  resample_boxfilter_func (dest_buf,
-                           source_buf,
-                           dst_rect,
-                           src_rect,
-                           s_rowstride,
-                           scale,
-                           babl_format_get_bytes_per_pixel (format),
-                           d_rowstride);
+    gegl_resample_nearest (dest_buf, source_buf, dst_rect, src_rect,
+                           s_rowstride, scale, bpp, d_rowstride);
 }
 
 void


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