added GEGL_CFLAGS. added an alternate GEGL code path that can be enabled

* app/core/Makefile.am: added GEGL_CFLAGS.
* app/core/gimpdrawable-invert.c: added an alternate GEGL code path
that can be enabled by uncommenting ENABLE_GEGL in the file.

svn path=/trunk/; revision=24482
This commit is contained in:
Øyvind Kolås 2007-12-30 15:39:35 +00:00
parent 43f8239668
commit c4195b95f3
3 changed files with 126 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2007-12-30 Øyvind Kolås <pippin@gimp.org>
* app/core/Makefile.am: added GEGL_CFLAGS.
* app/core/gimpdrawable-invert.c: added an alternate GEGL code path
that can be enabled by uncommenting ENABLE_GEGL in the file.
2007-12-30 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/gimpmodule.c
@ -16,6 +22,14 @@
* plug-ins/pygimp/pygimp.h
* plug-ins/pygimp/pygimp-tile.c: Basic wrapping of GimpPixelFetcher.
2007-12-30 Øyvind Kolås <pippin@gimp.org>
reviewed by: <delete if not using a buddy>
* app/core/Makefile.am:
* app/core/gimpdrawable-invert.c: (idle_fun),
(gimp_drawable_invert):
2007-12-30 Øyvind Kolås <pippin@gimp.org>
* app/gegl/gimpoperationtilesink.c: specify that this operation does

View File

@ -13,6 +13,7 @@ INCLUDES = \
$(LIBART_CFLAGS) \
$(GEGL_CFLAGS) \
$(GLIB_CFLAGS) \
$(GEGL_CFLAGS) \
-I$(includedir)
noinst_LIBRARIES = libappcore.a

View File

@ -16,6 +16,115 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*#define ENABLE_GEGL*/
#ifdef ENABLE_GEGL
#include "config.h"
#include <glib-object.h>
#include <gegl.h>
#include "core-types.h"
#include "gimpdrawable.h"
#include "gimpdrawable-invert.h"
#include "gimpimage.h"
#include "gimpprogress.h"
#include "gimp-intl.h"
typedef struct Data {
GeglNode *gegl;
GeglNode *output;
GeglProcessor *processor;
GeglRectangle rect;
GimpDrawable *drawable;
GimpProgress *progress;
} Data;
static gboolean
idle_fun (gpointer fdata)
{
Data *data = fdata;
gboolean more_work;
gdouble progress;
more_work = gegl_processor_work (data->processor, &progress);
if (more_work)
{
gimp_progress_set_text (data->progress, _("Invert"));
gimp_progress_set_value (data->progress, progress);
return TRUE;
}
g_object_unref (data->processor);
gimp_drawable_update (data->drawable, data->rect.x, data->rect.y,
data->rect.width, data->rect.height);
gimp_drawable_merge_shadow (data->drawable, TRUE, _("Invert"));
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (data->drawable));
if (image)
{
/* FIXME: gimp image flush has already been called by the action,
* it needs to still do so as long as only the ifdef is used to
* toggle between the versions
*/
gimp_image_flush (image);
}
}
gimp_progress_end (data->progress);
g_object_unref (data->gegl);
g_free (data);
return FALSE;
}
void
gimp_drawable_invert (GimpDrawable *drawable,
GimpProgress *progress)
{
GeglNode *input;
GeglNode *invert;
Data *data;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
data = g_malloc0 (sizeof (Data));
data->drawable = drawable;
if (! gimp_drawable_mask_intersect (drawable,
&data->rect.x, &data->rect.y,
&data->rect.width, &data->rect.height))
return;
data->gegl = gegl_node_new ();
data->progress = progress;
input = gegl_node_new_child (data->gegl,
"operation", "gimp-tilemanager-source",
"tile-manager", gimp_drawable_get_tiles (drawable),
NULL);
data->output = gegl_node_new_child (data->gegl,
"operation", "gimp-tilemanager-sink",
"tile-manager", gimp_drawable_get_shadow_tiles (drawable),
NULL);
invert = gegl_node_new_child (data->gegl,
"operation", "invert",
NULL);
gegl_node_link_many (input, invert, data->output, NULL);
data->processor = gegl_node_new_processor (data->output, &data->rect);
gimp_progress_start (data->progress, _("Invert"), FALSE);
/* do the actual processing in an idle callback */
g_idle_add (idle_fun, data);
}
#else /* ENABLE_GEGL is not defined */
#include "config.h"
#include <glib-object.h>
@ -65,3 +174,5 @@ gimp_drawable_invert (GimpDrawable *drawable,
gimp_drawable_update (drawable, x, y, width, height);
}
#endif