[gimp/soc-2010-cage-2] app: remove forward transform preview from cage tool, reverse is actually faster
- From: Alexia Death <alexiade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2010-cage-2] app: remove forward transform preview from cage tool, reverse is actually faster
- Date: Wed, 6 Oct 2010 21:57:26 +0000 (UTC)
commit d7492cb52895bae5d100b4f8997c0cb58a840c3a
Author: Alexia Death <alexiadeath gmail com>
Date: Thu Oct 7 00:37:04 2010 +0300
app: remove forward transform preview from cage tool, reverse is actually faster
app/gegl/Makefile.am | 2 -
app/gegl/gimp-gegl.c | 2 -
app/gegl/gimpoperationcagepreview.c | 282 -----------------------------------
app/gegl/gimpoperationcagepreview.h | 58 -------
app/tools/gimpcagetool.c | 145 +++++++++++--------
5 files changed, 86 insertions(+), 403 deletions(-)
---
diff --git a/app/gegl/Makefile.am b/app/gegl/Makefile.am
index 384a6ca..e5c9c10 100644
--- a/app/gegl/Makefile.am
+++ b/app/gegl/Makefile.am
@@ -55,8 +55,6 @@ libappgegl_a_SOURCES = \
gimpoperationcolorize.h \
gimpoperationcagecoefcalc.c \
gimpoperationcagecoefcalc.h \
- gimpoperationcagepreview.c \
- gimpoperationcagepreview.h \
gimpoperationcagetransform.c \
gimpoperationcagetransform.h \
gimpoperationcurves.c \
diff --git a/app/gegl/gimp-gegl.c b/app/gegl/gimp-gegl.c
index 9f94dfd..e5f8a51 100644
--- a/app/gegl/gimp-gegl.c
+++ b/app/gegl/gimp-gegl.c
@@ -32,7 +32,6 @@
#include "gimp-gegl.h"
#include "gimpoperationcagecoefcalc.h"
-#include "gimpoperationcagepreview.h"
#include "gimpoperationcagetransform.h"
#include "gimpoperationcolorbalance.h"
#include "gimpoperationcolorize.h"
@@ -99,7 +98,6 @@ gimp_gegl_init (Gimp *gimp)
g_type_class_ref (GIMP_TYPE_OPERATION_TILE_SOURCE);
g_type_class_ref (GIMP_TYPE_OPERATION_CAGE_COEF_CALC);
- g_type_class_ref (GIMP_TYPE_OPERATION_CAGE_PREVIEW);
g_type_class_ref (GIMP_TYPE_OPERATION_CAGE_TRANSFORM);
g_type_class_ref (GIMP_TYPE_OPERATION_COLOR_BALANCE);
g_type_class_ref (GIMP_TYPE_OPERATION_COLORIZE);
diff --git a/app/tools/gimpcagetool.c b/app/tools/gimpcagetool.c
index 08cc563..ce5ed44 100644
--- a/app/tools/gimpcagetool.c
+++ b/app/tools/gimpcagetool.c
@@ -119,6 +119,10 @@ static void gimp_cage_tool_prepare_preview (GimpCageTool *ct
GimpDisplay *display);
static gboolean gimp_cage_tool_update_preview (GimpTool *tool);
+static GeglNode* gimp_cage_tool_get_render_node (GimpCageTool *ct,
+ GeglNode *parent);
+
+
G_DEFINE_TYPE (GimpCageTool, gimp_cage_tool, GIMP_TYPE_DRAW_TOOL)
#define parent_class gimp_cage_tool_parent_class
@@ -695,7 +699,7 @@ gimp_cage_tool_compute_coef (GimpCageTool *ct,
NULL);
gegl_node_connect_to (input, "output",
- output, "input");
+ output, "input");
processor = gegl_node_new_processor (output, NULL);
@@ -711,14 +715,64 @@ gimp_cage_tool_compute_coef (GimpCageTool *ct,
g_object_unref (gegl);
}
+static GeglNode*
+gimp_cage_tool_get_render_node (GimpCageTool *ct,
+ GeglNode *parent)
+{
+ GimpCageOptions *options = GIMP_CAGE_TOOL_GET_OPTIONS (ct);
+
+ GeglNode *cage, *render; /* Render nodes */
+ GeglNode *input, *output, *aux; /* Proxy nodes*/
+ GeglNode *node; /* wraper to be returned */
+
+ node = gegl_node_new_child (parent,
+ /* FIXME: Leavin this empty causes compiler warning,
+ * but adding it causes a hang.
+ * "operation", "gegl:nop", */
+ NULL);
+
+ input = gegl_node_get_input_proxy (node, "input");
+ aux = gegl_node_get_input_proxy (node, "aux");
+ output = gegl_node_get_output_proxy (node, "output");
+
+
+ cage = gegl_node_new_child (parent,
+ "operation", "gimp:cage_transform",
+ "config", ct->config,
+ "fill_plain_color", options->fill_plain_color,
+ NULL);
+
+ render = gegl_node_new_child (parent,
+ "operation", "gegl:render_mapping",
+ NULL);
+
+ gegl_node_connect_to (input, "output",
+ cage, "input");
+
+ gegl_node_connect_to (aux, "output",
+ cage, "aux");
+
+ gegl_node_connect_to (input, "output",
+ render, "input");
+
+ gegl_node_connect_to (cage, "output",
+ render, "aux");
+
+ gegl_node_connect_to (render, "output",
+ output, "input");
+ return node;
+}
+
static void
gimp_cage_tool_prepare_preview (GimpCageTool *ct,
GimpDisplay *display)
{
- GimpImage *image = gimp_display_get_image (display);
- GimpDrawable *drawable = gimp_image_get_active_drawable (image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
+
- GeglNode *coef, *cage;
+ GeglNode *coef;
+ GeglNode *node;
if (ct->node_preview)
{
@@ -733,17 +787,15 @@ gimp_cage_tool_prepare_preview (GimpCageTool *ct,
"buffer", ct->coef,
NULL);
- cage = gegl_node_new_child (ct->node_preview,
- "operation", "gimp:cage_preview",
- "config", ct->config,
- NULL);
+ node = gimp_cage_tool_get_render_node (ct,
+ ct->node_preview);
gegl_node_connect_to (coef, "output",
- cage, "aux");
+ node, "aux");
ct->image_map = gimp_image_map_new (drawable,
_("Cage transform"),
- cage,
+ node,
NULL,
NULL);
}
@@ -780,8 +832,8 @@ static void
gimp_cage_tool_process (GimpCageTool *ct,
GimpDisplay *display)
{
- GimpCageOptions *options = GIMP_CAGE_TOOL_GET_OPTIONS (ct);
- TileManager *new_tiles;
+ TileManager *new_tiles = NULL;
+ TileManager *old_tiles = NULL;
GeglRectangle rect;
GimpImage *image = gimp_display_get_image (display);
@@ -797,55 +849,24 @@ gimp_cage_tool_process (GimpCageTool *ct,
{
GeglNode *gegl = gegl_node_new ();
-#ifdef DEBUG_CAGE
- /* debug coeficient */
- GeglNode *coef, *debug, *output;
-
- coef = gegl_node_new_child (gegl,
- "operation", "gegl:buffer-source",
- "buffer", ct->coef,
- NULL);
-
- new_tiles = gimp_drawable_get_shadow_tiles (drawable);
- output = gegl_node_new_child (gegl,
- "operation", "gimp:tilemanager-sink",
- "tile-manager", new_tiles,
- "linear", TRUE,
- NULL);
-
- debug = gegl_node_new_child (gegl,
- "operation", "gegl:debugit",
- NULL);
-
- gegl_node_connect_to (coef, "output",
- debug, "input");
-
- gegl_node_connect_to (debug, "output",
- output, "input");
-#else
/* reverse transform */
- GeglNode *coef, *cage, *render, *input, *output;
+ GeglNode *coef, *node, *input, *output;
+
+ old_tiles = gimp_drawable_get_tiles (drawable);
input = gegl_node_new_child (gegl,
"operation", "gimp:tilemanager-source",
- "tile-manager", gimp_drawable_get_tiles (drawable),
+ "tile-manager", old_tiles,
"linear", TRUE,
NULL);
- cage = gegl_node_new_child (gegl,
- "operation", "gimp:cage_transform",
- "config", ct->config,
- "fill_plain_color", options->fill_plain_color,
- NULL);
-
coef = gegl_node_new_child (gegl,
"operation", "gegl:buffer-source",
"buffer", ct->coef,
NULL);
- render = gegl_node_new_child (gegl,
- "operation", "gegl:render_mapping",
- NULL);
+ node = gimp_cage_tool_get_render_node (ct,
+ gegl);
new_tiles = gimp_drawable_get_shadow_tiles (drawable);
output = gegl_node_new_child (gegl,
@@ -855,20 +876,26 @@ gimp_cage_tool_process (GimpCageTool *ct,
NULL);
gegl_node_connect_to (input, "output",
- cage, "input");
-
- gegl_node_connect_to (input, "output",
- render, "input");
+ node, "input");
gegl_node_connect_to (coef, "output",
- cage, "aux");
-
- gegl_node_connect_to (cage, "output",
- render, "aux");
+ node, "aux");
- gegl_node_connect_to (render, "output",
+ gegl_node_connect_to (node, "output",
output, "input");
-#endif
+
+ /* Debug code sample for debugging coef calculation.*/
+
+ /*
+ debug = gegl_node_new_child (gegl,
+ "operation", "gegl:debugit",
+ NULL);
+
+ gegl_node_connect_to (coef, "output",
+ debug, "input");
+
+ gegl_node_connect_to (debug, "output",
+ output, "input");*/
progress = gimp_progress_start (GIMP_PROGRESS (display),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]