gegl r2884 - in trunk: . gegl/buffer operations/core operations/external
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2884 - in trunk: . gegl/buffer operations/core operations/external
- Date: Sat, 24 Jan 2009 09:31:37 +0000 (UTC)
Author: martinn
Date: Sat Jan 24 09:31:37 2009
New Revision: 2884
URL: http://svn.gnome.org/viewvc/gegl?rev=2884&view=rev
Log:
Adapt to the new babl API, use babl_format_get_bytes_per_pixel(),
babl_get_name(), babl_format_get_num_of_components() and
babl_format_get_type().
* gegl/buffer/gegl-buffer-access.c
* gegl/buffer/gegl-buffer-iterator.c
* gegl/buffer/gegl-buffer-linear.c
* gegl/buffer/gegl-buffer-load.c
* gegl/buffer/gegl-buffer-save.c
* gegl/buffer/gegl-sampler.c
* gegl/buffer/gegl-tile-backend-file.c
* gegl/buffer/gegl-tile-backend.c
* gegl/buffer/gegl-tile-handler-zoom.c
* operations/core/convert-format.c
* operations/external/png-save.c
* operations/external/save-pixbuf.c
Modified:
trunk/ChangeLog
trunk/gegl/buffer/gegl-buffer-access.c
trunk/gegl/buffer/gegl-buffer-iterator.c
trunk/gegl/buffer/gegl-buffer-linear.c
trunk/gegl/buffer/gegl-buffer-load.c
trunk/gegl/buffer/gegl-buffer-save.c
trunk/gegl/buffer/gegl-sampler.c
trunk/gegl/buffer/gegl-tile-backend-file.c
trunk/gegl/buffer/gegl-tile-backend.c
trunk/gegl/buffer/gegl-tile-handler-zoom.c
trunk/operations/core/convert-format.c
trunk/operations/external/png-save.c
trunk/operations/external/save-pixbuf.c
Modified: trunk/gegl/buffer/gegl-buffer-access.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-access.c (original)
+++ trunk/gegl/buffer/gegl-buffer-access.c Sat Jan 24 09:31:37 2009
@@ -46,16 +46,6 @@
GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
#endif
-#ifdef BABL
-#undef BABL
-#endif
-
-#define BABL(o) ((Babl *) (o))
-
-#ifdef FMTPXS
-#undef FMTPXS
-#endif
-#define FMTPXS(fmt) (BABL (fmt)->format.bytes_per_pixel)
#if 0
static inline void
@@ -68,7 +58,7 @@
gint tile_width = buffer->tile_storage->tile_width;
gint tile_height = buffer->tile_storage->tile_width;
gint px_size = gegl_buffer_px_size (buffer);
- gint bpx_size = FMTPXS (format);
+ gint bpx_size = babl_format_get_bytes_per_pixel (format);
Babl *fish = NULL;
gint abyss_x_total = buffer->abyss.x + buffer->abyss.width;
@@ -134,7 +124,7 @@
guchar *buf = data;
gint tile_width = buffer->tile_storage->tile_width;
gint tile_height = buffer->tile_storage->tile_height;
- gint bpx_size = FMTPXS (format);
+ gint bpx_size = babl_format_get_bytes_per_pixel (format);
Babl *fish = NULL;
gint buffer_shift_x = buffer->shift_x;
@@ -143,7 +133,7 @@
gint buffer_abyss_y = buffer->abyss.y + buffer_shift_y;
gint abyss_x_total = buffer_abyss_x + buffer->abyss.width;
gint abyss_y_total = buffer_abyss_y + buffer->abyss.height;
- gint px_size = FMTPXS (buffer->format);
+ gint px_size = babl_format_get_bytes_per_pixel (buffer->format);
if (format != buffer->format)
{
@@ -218,7 +208,7 @@
guchar *buf = data;
gint tile_width = buffer->tile_storage->tile_width;
gint tile_height = buffer->tile_storage->tile_height;
- gint bpx_size = FMTPXS (format);
+ gint bpx_size = babl_format_get_bytes_per_pixel (format);
Babl *fish = NULL;
gint buffer_shift_x = buffer->shift_x;
@@ -227,7 +217,7 @@
gint buffer_abyss_y = buffer->abyss.y + buffer_shift_y;
gint abyss_x_total = buffer_abyss_x + buffer->abyss.width;
gint abyss_y_total = buffer_abyss_y + buffer->abyss.height;
- gint px_size = FMTPXS (buffer->format);
+ gint px_size = babl_format_get_bytes_per_pixel (buffer->format);
if (format != buffer->format)
{
@@ -330,8 +320,8 @@
gint tile_width = buffer->tile_storage->tile_width;
gint tile_height = buffer->tile_storage->tile_height;
- gint px_size = FMTPXS (buffer->format);
- gint bpx_size = FMTPXS (format);
+ gint px_size = babl_format_get_bytes_per_pixel (buffer->format);
+ gint bpx_size = babl_format_get_bytes_per_pixel (format);
gint tile_stride = px_size * tile_width;
gint buf_stride;
gint bufy = 0;
@@ -994,7 +984,7 @@
gint level = 0;
gint buf_width = rect->width / scale;
gint buf_height = rect->height / scale;
- gint bpp = BABL (format)->format.bytes_per_pixel;
+ gint bpp = babl_format_get_bytes_per_pixel (format);
GeglRectangle sample_rect = { floor(rect->x/scale),
floor(rect->y/scale),
buf_width,
@@ -1030,7 +1020,7 @@
* no time to make a fast implementation
*/
- if (BABL (format)->format.type[0] == (BablType *) babl_type ("u8")
+ if (babl_format_get_type (format, 0) == babl_type ("u8")
&& !(level == 0 && scale > 1.99))
{ /* do box-filter resampling if we're 8bit (which projections are) */
@@ -1201,7 +1191,7 @@
dst_rect->height == 0)
return;
- pxsize = dst->format->format.bytes_per_pixel;
+ pxsize = babl_format_get_bytes_per_pixel (dst->format);
/* FIXME: this can be even further optimized by special casing it so
* that fully voided tiles are dropped.
Modified: trunk/gegl/buffer/gegl-buffer-iterator.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-iterator.c (original)
+++ trunk/gegl/buffer/gegl-buffer-iterator.c Sat Jan 24 09:31:37 2009
@@ -191,7 +191,7 @@
i->data = gegl_tile_get_data (i->tile);
{
- gint bpp = i->buffer->format->format.bytes_per_pixel;
+ gint bpp = babl_format_get_bytes_per_pixel (i->buffer->format);
i->rowstride = bpp * tile_width;
i->sub_data = (guchar*)(i->data) + bpp * (i->subrect.y * tile_width + i->subrect.x);
}
@@ -356,7 +356,7 @@
* would probably improve performance
*/
if (i->buf[no]==NULL)
- i->buf[no] = iterator_buf_pool_get (i->format[no]->format.bytes_per_pixel *
+ i->buf[no] = iterator_buf_pool_get (babl_format_get_bytes_per_pixel (i->format[no]) *
i->i[0].max_size);
}
Modified: trunk/gegl/buffer/gegl-buffer-linear.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-linear.c (original)
+++ trunk/gegl/buffer/gegl-buffer-linear.c Sat Jan 24 09:31:37 2009
@@ -77,7 +77,7 @@
*/
rowstride = extent->width;
else
- rowstride = rowstride / format->format.bytes_per_pixel;
+ rowstride = rowstride / babl_format_get_bytes_per_pixel (format);
buffer = gegl_buffer_linear_new2 (extent, format, rowstride);
{
@@ -90,7 +90,7 @@
tile->y = 0;
tile->z = 0;
tile->data = (gpointer)data;
- tile->size = format->format.bytes_per_pixel * rowstride * extent->height;
+ tile->size = babl_format_get_bytes_per_pixel (format) * rowstride * extent->height;
tile->next_shared = tile;
tile->prev_shared = tile;
@@ -155,7 +155,7 @@
g_object_set_data (G_OBJECT (buffer), "linear-tile", tile);
- if(rowstride)*rowstride = buffer->tile_storage->tile_width * format->format.bytes_per_pixel;
+ if(rowstride)*rowstride = buffer->tile_storage->tile_width * babl_format_get_bytes_per_pixel (format);
return (gpointer)gegl_tile_get_data (tile);
}
/* first check if there is a linear buffer, share the existing buffer if one
@@ -194,7 +194,7 @@
info->extent = buffer->extent;
info->format = format;
- rs = info->extent.width * format->format.bytes_per_pixel;
+ rs = info->extent.width * babl_format_get_bytes_per_pixel (format);
if(rowstride)*rowstride = rs;
info->buf = gegl_malloc (rs * info->extent.height);
Modified: trunk/gegl/buffer/gegl-buffer-load.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-load.c (original)
+++ trunk/gegl/buffer/gegl-buffer-load.c Sat Jan 24 09:31:37 2009
@@ -372,7 +372,7 @@
/* sanity check, should probably report error condition and return safely instead
*/
- g_assert (info->format->format.bytes_per_pixel == info->header.bytes_per_pixel);
+ g_assert (babl_format_get_bytes_per_pixel (info->format) == info->header.bytes_per_pixel);
info->tiles = gegl_buffer_read_index (info->i, &info->offset);
Modified: trunk/gegl/buffer/gegl-buffer-save.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-save.c (original)
+++ trunk/gegl/buffer/gegl-buffer-save.c Sat Jan 24 09:31:37 2009
@@ -204,7 +204,7 @@
{
gchar buf[64];
g_snprintf (buf, 64, "%s%c\n%iÃ%i %ibpp\n%ix%i\n\n\n\n\n\n\n\n\n",
- format->instance.name, 0,
+ babl_get_name (format), 0,
header->tile_width,
header->tile_height,
header->bytes_per_pixel,
Modified: trunk/gegl/buffer/gegl-sampler.c
==============================================================================
--- trunk/gegl/buffer/gegl-sampler.c (original)
+++ trunk/gegl/buffer/gegl-sampler.c Sat Jan 24 09:31:37 2009
@@ -215,7 +215,7 @@
gint bpp;
gint sof;
- bpp = sampler->interpolate_format->format.bytes_per_pixel;
+ bpp = babl_format_get_bytes_per_pixel (sampler->interpolate_format);
if (sampler->sampler_buffer == NULL
||
@@ -284,7 +284,7 @@
gint bpp;
gint sof;
- bpp = sampler->interpolate_format->format.bytes_per_pixel;
+ bpp = babl_format_get_bytes_per_pixel (sampler->interpolate_format);
if (sampler->sampler_buffer == NULL
||
Modified: trunk/gegl/buffer/gegl-tile-backend-file.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend-file.c (original)
+++ trunk/gegl/buffer/gegl-tile-backend-file.c Sat Jan 24 09:31:37 2009
@@ -917,7 +917,7 @@
backend->tile_width = self->header.tile_width;
backend->tile_height = self->header.tile_height;
backend->format = babl_format (self->header.description);
- backend->px_size = backend->format->format.bytes_per_pixel;
+ backend->px_size = babl_format_get_bytes_per_pixel (backend->format);
backend->tile_size = backend->tile_width * backend->tile_height * backend->px_size;
/* insert each of the entries into the hash table */
Modified: trunk/gegl/buffer/gegl-tile-backend.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend.c (original)
+++ trunk/gegl/buffer/gegl-tile-backend.c Sat Jan 24 09:31:37 2009
@@ -114,7 +114,7 @@
g_assert (backend->tile_width > 0 && backend->tile_height > 0);
g_assert (backend->format);
- backend->px_size = backend->format->format.bytes_per_pixel;
+ backend->px_size = babl_format_get_bytes_per_pixel (backend->format);
backend->tile_size = backend->tile_width * backend->tile_height * backend->px_size;
return object;
Modified: trunk/gegl/buffer/gegl-tile-handler-zoom.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-zoom.c (original)
+++ trunk/gegl/buffer/gegl-tile-handler-zoom.c Sat Jan 24 09:31:37 2009
@@ -50,7 +50,7 @@
gint j)
{
guchar *dst_data = gegl_tile_get_data (dst_tile);
- gint bpp = format->format.bytes_per_pixel;
+ gint bpp = babl_format_get_bytes_per_pixel (format);
gint rowstride = width * bpp;
gint scanline;
@@ -76,7 +76,7 @@
{
guchar *dst_data = gegl_tile_get_data (dst_tile);
guchar *src_data = gegl_tile_get_data (src_tile);
- gint bpp = format->format.bytes_per_pixel;
+ gint bpp = babl_format_get_bytes_per_pixel (format);
gint x, y;
for (y = 0; y < height / 2; y++)
@@ -177,17 +177,17 @@
{
guchar *dst_data = gegl_tile_get_data (dst_tile);
guchar *src_data = gegl_tile_get_data (src_tile);
- gint components = format->format.components;
- gint bpp = format->format.bytes_per_pixel;
+ gint components = babl_format_get_num_of_components (format);
+ gint bpp = babl_format_get_bytes_per_pixel (format);
if (i) dst_data += bpp * width / 2;
if (j) dst_data += bpp * width * height / 2;
- if (format->format.type[0] == (BablType *) babl_type ("float"))
+ if (babl_format_get_type (format, 0) == babl_type ("float"))
{
downscale_float (components, width, height, width * bpp, src_data, dst_data);
}
- else if (format->format.type[0] == (BablType *) babl_type ("u8"))
+ else if (babl_format_get_type (format, 0) == babl_type ("u8"))
{
downscale_u8 (components, width, height, width * bpp, src_data, dst_data);
}
Modified: trunk/operations/core/convert-format.c
==============================================================================
--- trunk/operations/core/convert-format.c (original)
+++ trunk/operations/core/convert-format.c Sat Jan 24 09:31:37 2009
@@ -56,7 +56,7 @@
glong samples,
const GeglRectangle *roi)
{
- int bpp = gegl_operation_get_format(op, "output")->format.bytes_per_pixel;
+ int bpp = babl_format_get_bytes_per_pixel (gegl_operation_get_format (op, "output"));
memcpy(out_buf, in_buf, samples * bpp);
return TRUE;
}
Modified: trunk/operations/external/png-save.c
==============================================================================
--- trunk/operations/external/png-save.c (original)
+++ trunk/operations/external/png-save.c Sat Jan 24 09:31:37 2009
@@ -89,14 +89,11 @@
{
const Babl *babl; /*= gegl_buffer->format;*/
- BablType **type;
g_object_get (gegl_buffer, "format", &babl, NULL);
- type = babl->format.type;
- for (i=0; i<babl->format.components; i++)
- if ((*type)->bits > 8)
- bit_depth = 16;
+ if (babl_format_get_type (babl, 0) != babl_type ("u8"))
+ bit_depth = 16;
if (bd == 16)
bit_depth = 16;
Modified: trunk/operations/external/save-pixbuf.c
==============================================================================
--- trunk/operations/external/save-pixbuf.c (original)
+++ trunk/operations/external/save-pixbuf.c Sat Jan 24 09:31:37 2009
@@ -17,6 +17,9 @@
*/
#include "config.h"
+
+#include <babl/babl.h>
+
#include <glib/gi18n-lib.h>
@@ -44,21 +47,16 @@
{
GdkPixbuf **pixbuf = o->pixbuf;
const Babl *babl;
- const BablFormat *format;
+ const Babl *format;
guchar *temp;
GeglRectangle *rect = gegl_operation_source_get_bounding_box (operation, "input");
gchar *name;
gboolean has_alpha;
gint bps;
- guint i;
- g_object_get (input, "format", &babl, NULL);
- format = (BablFormat*) babl;
+ g_object_get (input, "format", &format, NULL);
- has_alpha = FALSE;
- for (i = 0; i < format->components; i++) {
- has_alpha = has_alpha || format->component[i]->alpha != 0;
- }
+ has_alpha = babl_format_has_alpha (format);
/* pixbuf from data only support 8bit bps */
bps = 8;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]