[gegl] Pass bpp instead of component count for boxfilter



commit d3a26056cd572941500cdba3d3e0ae4c89a6f9ff
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Wed Mar 5 08:11:43 2014 -0800

    Pass bpp instead of component count for boxfilter

 gegl/gegl-algorithms-boxfilter.inc |    3 ++-
 gegl/gegl-algorithms.c             |   17 +++--------------
 gegl/gegl-algorithms.h             |    8 ++++----
 3 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/gegl/gegl-algorithms-boxfilter.inc b/gegl/gegl-algorithms-boxfilter.inc
index 21514eb..3db883b 100644
--- a/gegl/gegl-algorithms-boxfilter.inc
+++ b/gegl/gegl-algorithms-boxfilter.inc
@@ -5,13 +5,14 @@ BOXFILTER_FUNCNAME (guchar              *dest_buf,
                     const GeglRectangle *src_rect,
                     const gint           s_rowstride,
                     const gdouble        scale,
-                    const gint           components,
+                    const gint           bpp,
                     const gint           d_rowstride)
 {
   gdouble  left_weight, center_weight, right_weight;
   gdouble  top_weight, middle_weight, bottom_weight;
   const BOXFILTER_TYPE *src[9];
   gint     x, y;
+  gint     components = bpp / sizeof(BOXFILTER_TYPE);
 
   for (y = 0; y < dst_rect->height; y++)
     {
diff --git a/gegl/gegl-algorithms.c b/gegl/gegl-algorithms.c
index 98c7c9a..fbf3bd9 100644
--- a/gegl/gegl-algorithms.c
+++ b/gegl/gegl-algorithms.c
@@ -92,7 +92,6 @@ void gegl_resample_boxfilter (guchar              *dest_buf,
                               gint                 d_rowstride)
 {
   const Babl *comp_type  = babl_format_get_type (format, 0);
-  guint num_componenets;
 
   void (*resample_boxfilter_func) (guchar              *dest_buf,
                                    const guchar        *source_buf,
@@ -100,7 +99,7 @@ void gegl_resample_boxfilter (guchar              *dest_buf,
                                    const GeglRectangle *src_rect,
                                    gint                 s_rowstride,
                                    gdouble              scale,
-                                   gint                 components,
+                                   gint                 bpp,
                                    gint                 d_rowstride) = NULL;
 
   if (comp_type == babl_type ("u8"))
@@ -121,26 +120,16 @@ void gegl_resample_boxfilter (guchar              *dest_buf,
     }
   else
     {
-      gegl_resample_nearest (dest_buf,
-                             source_buf,
-                             dst_rect,
-                             src_rect,
-                             s_rowstride,
-                             scale,
-                             babl_format_get_bytes_per_pixel (format),
-                             d_rowstride);
-      return;
+      resample_boxfilter_func = gegl_resample_nearest;
     }
 
-  num_componenets = babl_format_get_n_components (format);
-
   resample_boxfilter_func (dest_buf,
                            source_buf,
                            dst_rect,
                            src_rect,
                            s_rowstride,
                            scale,
-                           num_componenets,
+                           babl_format_get_bytes_per_pixel (format),
                            d_rowstride);
 }
 
diff --git a/gegl/gegl-algorithms.h b/gegl/gegl-algorithms.h
index bd0b2cc..ce8b9dd 100644
--- a/gegl/gegl-algorithms.h
+++ b/gegl/gegl-algorithms.h
@@ -90,7 +90,7 @@ void gegl_resample_boxfilter_float (guchar              *dest_buf,
                                     const GeglRectangle *src_rect,
                                     gint                 s_rowstride,
                                     gdouble              scale,
-                                    gint                 components,
+                                    gint                 bpp,
                                     gint                 d_rowstride);
 
 void gegl_resample_boxfilter_u32 (guchar              *dest_buf,
@@ -99,7 +99,7 @@ void gegl_resample_boxfilter_u32 (guchar              *dest_buf,
                                   const GeglRectangle *src_rect,
                                   gint                 s_rowstride,
                                   gdouble              scale,
-                                  gint                 components,
+                                  gint                 bpp,
                                   gint                 d_rowstride);
 
 void gegl_resample_boxfilter_u16 (guchar              *dest_buf,
@@ -108,7 +108,7 @@ void gegl_resample_boxfilter_u16 (guchar              *dest_buf,
                                   const GeglRectangle *src_rect,
                                   gint                 s_rowstride,
                                   gdouble              scale,
-                                  gint                 components,
+                                  gint                 bpp,
                                   gint                 d_rowstride);
 
 void gegl_resample_boxfilter_u8 (guchar              *dest_buf,
@@ -117,7 +117,7 @@ void gegl_resample_boxfilter_u8 (guchar              *dest_buf,
                                  const GeglRectangle *src_rect,
                                  gint                 s_rowstride,
                                  gdouble              scale,
-                                 gint                 components,
+                                 gint                 bpp,
                                  gint                 d_rowstride);
 
 void gegl_resample_nearest (guchar              *dst,


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