|
Packit Service |
2781ba |
/* This file is part of GEGL.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
2781ba |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
2781ba |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
2781ba |
* version 3 of the License, or (at your option) any later version.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
2781ba |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
2781ba |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
2781ba |
* Lesser General Public License for more details.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
2781ba |
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Copyright 2006,2007 Øyvind Kolås <pippin@gimp.org>
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#include "config.h"
|
|
Packit Service |
2781ba |
#include <string.h>
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#include <glib-object.h>
|
|
Packit Service |
2781ba |
#include <glib/gprintf.h>
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#include "gegl.h"
|
|
Packit Service |
2781ba |
#include "gegl-types-internal.h"
|
|
Packit Service |
2781ba |
#include "gegl-buffer-types.h"
|
|
Packit Service |
2781ba |
#include "gegl-buffer.h"
|
|
Packit Service |
2781ba |
#include "gegl-buffer-private.h"
|
|
Packit Service |
2781ba |
#include "gegl-id-pool.h"
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#if 0
|
|
Packit Service |
2781ba |
static GeglIDPool *pool = NULL;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
guint
|
|
Packit Service |
2781ba |
gegl_buffer_share (GeglBuffer *buffer)
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
guint id;
|
|
Packit Service |
2781ba |
if (!pool)
|
|
Packit Service |
2781ba |
pool = gegl_id_pool_new (16);
|
|
Packit Service |
2781ba |
id = gegl_id_pool_add (pool, buffer);
|
|
Packit Service |
2781ba |
/* FIXME: weak reference to void the handle when the buffer is
|
|
Packit Service |
2781ba |
* finalized
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
return id;
|
|
Packit Service |
2781ba |
}
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
GeglBuffer*
|
|
Packit Service |
2781ba |
gegl_buffer_open (const gchar *uri)
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
/* only supports local addresses for now */
|
|
Packit Service |
2781ba |
guint process; /* self */
|
|
Packit Service |
2781ba |
guint handle;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
process = 0;
|
|
Packit Service |
2781ba |
handle = 0;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
if (!pool)
|
|
Packit Service |
2781ba |
pool = gegl_id_pool_new (16);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
if (!g_str_has_prefix (uri, "buffer://"))
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
g_warning ("'%s' does not start like a valid buffer handle", uri);
|
|
Packit Service |
2781ba |
return NULL;
|
|
Packit Service |
2781ba |
}
|
|
Packit Service |
2781ba |
if (g_str_has_prefix (uri, "buffer:////"))
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
/* local buffer */
|
|
Packit Service |
2781ba |
handle = atoi (uri + 11);
|
|
Packit Service |
2781ba |
g_print ("got %i, %p\n", handle, gegl_id_pool_lookup (pool, handle));
|
|
Packit Service |
2781ba |
return gegl_buffer_create_sub_buffer (gegl_id_pool_lookup (pool, handle), NULL);
|
|
Packit Service |
2781ba |
}
|
|
Packit Service |
2781ba |
g_warning ("don't know how to handle buffer path: %s", uri);
|
|
Packit Service |
2781ba |
return NULL;
|
|
Packit Service |
2781ba |
}
|
|
Packit Service |
2781ba |
#endif
|