[gegl/soc-2011-warp] implement support for format_n buffer in the nearest neighbour sampler (not sure if working yet)
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2011-warp] implement support for format_n buffer in the nearest neighbour sampler (not sure if working yet)
- Date: Sun, 4 Sep 2011 07:45:15 +0000 (UTC)
commit 24fe3af72187d7aea4174cca380c1108446cbb7b
Author: Michael Murà <batolettre gmail com>
Date: Sat Sep 3 16:34:01 2011 +0200
implement support for format_n buffer in the nearest neighbour sampler (not sure if working yet)
gegl/buffer/gegl-sampler-nearest.c | 18 +++++++++++++++---
gegl/buffer/gegl-sampler.h | 4 ++--
2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-nearest.c b/gegl/buffer/gegl-sampler-nearest.c
index 46fd9a1..321a992 100644
--- a/gegl/buffer/gegl-sampler-nearest.c
+++ b/gegl/buffer/gegl-sampler-nearest.c
@@ -78,9 +78,21 @@ gegl_sampler_nearest_get (GeglSampler *self,
GeglMatrix2 *scale,
void *output)
{
- gfloat *sampler_bptr;
- sampler_bptr = gegl_sampler_get_from_buffer (self, (gint)x, (gint)y);
- babl_process (babl_fish (self->interpolate_format, self->format), sampler_bptr, output, 1);
+ if (!babl_format_is_format_n (self->format))
+ {
+ gfloat *sampler_bptr;
+ sampler_bptr = gegl_sampler_get_from_buffer (self, (gint)x, (gint)y);
+
+ babl_process (babl_fish (self->interpolate_format, self->format), sampler_bptr, output, 1);
+ }
+ else
+ {
+ void *data;
+ gint nbyte;
+ data = gegl_sampler_get_from_buffer (self, (gint)x, (gint)y);
+ nbyte = babl_format_get_bytes_per_pixel (self->format);
+ memcpy (output, data, nbyte);
+ }
}
static void
diff --git a/gegl/buffer/gegl-sampler.h b/gegl/buffer/gegl-sampler.h
index 1e5b5f7..330b0e0 100644
--- a/gegl/buffer/gegl-sampler.h
+++ b/gegl/buffer/gegl-sampler.h
@@ -50,8 +50,8 @@ struct _GeglSampler
/*< private >*/
GeglBuffer *buffer;
- Babl *format;
- Babl *interpolate_format;
+ Babl *format; /* the format asked to return the data */
+ Babl *interpolate_format; /* the format used by the sampler to interpolate */
Babl *fish;
GeglRectangle context_rect[GEGL_SAMPLER_MIPMAP_LEVELS];
gpointer sampler_buffer[GEGL_SAMPLER_MIPMAP_LEVELS];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]