gegl r2218 - in trunk: . gegl gegl/buffer
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2218 - in trunk: . gegl gegl/buffer
- Date: Tue, 22 Apr 2008 11:16:43 +0100 (BST)
Author: ok
Date: Tue Apr 22 10:16:43 2008
New Revision: 2218
URL: http://svn.gnome.org/viewvc/gegl?rev=2218&view=rev
Log:
* gegl/gegl-plugin.h: fix the component access macros.
* gegl/buffer/gegl-buffer-access.c: (gegl_buffer_flush): store the
dimensions in the header of the file.
* gegl/buffer/gegl-buffer-save.c: (gegl_buffer_header_init): do
not set height/width of buffer in header_init.
* gegl/buffer/gegl-buffer-load.c: (load_info_destroy),
(gegl_buffer_read_header): #if 0'd unused code.
* gegl/buffer/gegl-buffer-private.h: added gegl_buffer_backend call.
* gegl/buffer/gegl-buffer.c:
* gegl/buffer/gegl-tile-backend-file.c:
(gegl_tile_backend_file_constructor): initialize the header here ..
(flush): .. instead of here.
Modified:
trunk/ChangeLog
trunk/gegl/buffer/gegl-buffer-access.c
trunk/gegl/buffer/gegl-buffer-load.c
trunk/gegl/buffer/gegl-buffer-private.h
trunk/gegl/buffer/gegl-buffer-save.c
trunk/gegl/buffer/gegl-buffer.c
trunk/gegl/buffer/gegl-tile-backend-file.c
trunk/gegl/gegl-plugin.h
Modified: trunk/gegl/buffer/gegl-buffer-access.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-access.c (original)
+++ trunk/gegl/buffer/gegl-buffer-access.c Tue Apr 22 10:16:43 2008
@@ -22,6 +22,7 @@
#include <glib-object.h>
#include <glib/gprintf.h>
+#include <gio/gio.h>
#include "gegl-types.h"
#include "gegl-buffer-types.h"
@@ -32,6 +33,8 @@
#include "gegl-sampler-nearest.h"
#include "gegl-sampler-linear.h"
#include "gegl-sampler-cubic.h"
+#include "gegl-buffer-index.h"
+#include "gegl-tile-backend.h"
#if ENABLE_MP
GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
@@ -294,6 +297,14 @@
g_object_unref (buffer->hot_tile);
buffer->hot_tile = NULL;
}
+ if ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))
+ {
+ ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))->x =buffer->extent.x;
+ ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))->y =buffer->extent.y;
+ ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))->width =buffer->extent.width;
+ ((GeglBufferHeader*)(gegl_buffer_backend (buffer)->header))->height =buffer->extent.height;
+ }
+
gegl_tile_source_command (GEGL_TILE_SOURCE (buffer),
GEGL_TILE_FLUSH, 0,0,0,NULL);
}
Modified: trunk/gegl/buffer/gegl-buffer-load.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-load.c (original)
+++ trunk/gegl/buffer/gegl-buffer-load.c Tue Apr 22 10:16:43 2008
@@ -45,6 +45,7 @@
#include <glib/gprintf.h>
+#if 0
typedef struct
{
GeglBufferHeader header;
@@ -59,7 +60,6 @@
gboolean got_header;
} LoadInfo;
-
static void seekto(LoadInfo *info, gint offset)
{
info->offset = offset;
@@ -70,6 +70,33 @@
}
}
+static void
+load_info_destroy (LoadInfo *info)
+{
+ if (!info)
+ return;
+ if (info->path)
+ g_free (info->path);
+ if (info->i)
+ g_object_unref (info->i);
+ if (info->file)
+ g_object_unref (info->file);
+
+ if (info->tiles != NULL)
+ {
+ GList *iter;
+ for (iter = info->tiles; iter; iter = iter->next)
+ {
+ g_free (iter->data);
+ }
+ g_list_free (info->tiles);
+ info->tiles = NULL;
+ }
+ g_slice_free (LoadInfo, info);
+}
+
+#endif
+
GeglBufferItem *
gegl_buffer_read_header (GInputStream *i,
goffset *offset)
@@ -86,10 +113,12 @@
sizeof(GeglBufferHeader),
NULL, NULL);
- GEGL_NOTE (BUFFER_LOAD, "read header: tile-width: %i tile-height: %i next:%i\n",
+ GEGL_NOTE (BUFFER_LOAD, "read header: tile-width: %i tile-height: %i next:%i %ix%i\n",
ret->header.tile_width,
ret->header.tile_height,
- (guint)ret->block.next);
+ (guint)ret->block.next,
+ ret->header.width,
+ ret->header.height);
if (!(ret->header.magic[0]=='G' &&
ret->header.magic[1]=='E' &&
@@ -192,30 +221,6 @@
return ret;
}
-static void
-load_info_destroy (LoadInfo *info)
-{
- if (!info)
- return;
- if (info->path)
- g_free (info->path);
- if (info->i)
- g_object_unref (info->i);
- if (info->file)
- g_object_unref (info->file);
-
- if (info->tiles != NULL)
- {
- GList *iter;
- for (iter = info->tiles; iter; iter = iter->next)
- {
- g_free (iter->data);
- }
- g_list_free (info->tiles);
- info->tiles = NULL;
- }
- g_slice_free (LoadInfo, info);
-}
static void sanity(void) { GEGL_BUFFER_SANITY; }
Modified: trunk/gegl/buffer/gegl-buffer-private.h
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-private.h (original)
+++ trunk/gegl/buffer/gegl-buffer-private.h Tue Apr 22 10:16:43 2008
@@ -89,4 +89,6 @@
void gegl_tile_cache_destroy (void);
+GeglTileBackend * gegl_buffer_backend (GeglBuffer *buffer);
+
#endif
Modified: trunk/gegl/buffer/gegl-buffer-save.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-save.c (original)
+++ trunk/gegl/buffer/gegl-buffer-save.c Tue Apr 22 10:16:43 2008
@@ -178,8 +178,6 @@
header->tile_width = tile_width;
header->tile_height = tile_height;
header->bytes_per_pixel = bpp;
- header->width = 256;
- header->height = 256;
{
gchar buf[64];
g_snprintf (buf, 64, "%s%c\n%iÃ%i %ibpp\n\n\n\n\n\n\n\n\n\n",
Modified: trunk/gegl/buffer/gegl-buffer.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer.c (original)
+++ trunk/gegl/buffer/gegl-buffer.c Tue Apr 22 10:16:43 2008
@@ -306,7 +306,7 @@
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-static GeglTileBackend *
+GeglTileBackend *
gegl_buffer_backend (GeglBuffer *buffer)
{
GeglTileSource *tmp = GEGL_TILE_SOURCE (buffer);
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 Tue Apr 22 10:16:43 2008
@@ -460,12 +460,6 @@
GEGL_NOTE (TILE_BACKEND, "flushing %s", self->path);
- gegl_buffer_header_init (&self->header,
- backend->tile_width,
- backend->tile_height,
- backend->px_size,
- backend->format
- );
self->header.next = self->next_pre_alloc; /* this is the offset
we start handing
out headers from*/
@@ -700,6 +694,7 @@
self->next_pre_alloc = max;
self->total = max;
self->tiles = NULL;
+
}
}
else
@@ -710,6 +705,14 @@
self->next_pre_alloc = 256; /* reserved space for header */
self->total = 256; /* reserved space for header */
g_assert(g_seekable_seek (G_SEEKABLE (self->o), 256, G_SEEK_SET, NULL, NULL));
+
+ gegl_buffer_header_init (&self->header,
+ backend->tile_width,
+ backend->tile_height,
+ backend->px_size,
+ backend->format
+ );
+ /* FIXME: should probably write an initial header */
}
g_assert (self->file);
Modified: trunk/gegl/gegl-plugin.h
==============================================================================
--- trunk/gegl/gegl-plugin.h (original)
+++ trunk/gegl/gegl-plugin.h Tue Apr 22 10:16:43 2008
@@ -95,9 +95,9 @@
#define Gegl4float_a(a) ((float *)(&a))
#define Gegl4floatR(a) Gegl4float_a(a)[0]
-#define Gegl4floatG(a) Gegl4float_a(a)[0]
-#define Gegl4floatB(a) Gegl4float_a(a)[0]
-#define Gegl4floatA(a) Gegl4float_a(a)[0]
+#define Gegl4floatG(a) Gegl4float_a(a)[1]
+#define Gegl4floatB(a) Gegl4float_a(a)[2]
+#define Gegl4floatA(a) Gegl4float_a(a)[3]
#define Gegl4float(a,b,c,d) ((Gegl4float){a,b,c,d})
#define Gegl4float_all(val) Gegl4float(val,val,val,val)
#define Gegl4float_zero Gegl4float_all(0.0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]