[gegl] bin: launch with graph visible if chain is provided on commandline



commit 2014802a3d347d9e02f3321c7a67f8c4b320e9fa
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Dec 22 16:58:18 2018 +0100

    bin: launch with graph visible if chain is provided on commandline

 bin/ui.c                      | 52 +++++++++++++++++++++----------------------
 gegl/gegl-config.c            |  2 +-
 gegl/process/gegl-processor.c |  4 ++--
 3 files changed, 28 insertions(+), 30 deletions(-)
---
diff --git a/bin/ui.c b/bin/ui.c
index e82832da4..84e1d398f 100644
--- a/bin/ui.c
+++ b/bin/ui.c
@@ -400,8 +400,6 @@ int mrg_ui_main (int argc, char **argv, char **ops)
   hack_state = &o;
   on_viewer_motion (NULL, &o, NULL);
 
-  if (o.ops)
-    o.active = gegl_node_get_producer (o.sink, "input", NULL);
 
   switch (renderer)
   {
@@ -416,8 +414,15 @@ int mrg_ui_main (int argc, char **argv, char **ops)
       break;
   }
 
-  if (o.active)
+  if (o.ops)
+  {
+    o.active = gegl_node_get_producer (o.sink, "input", NULL);
     o.show_graph = 1;
+  }
+  else
+  {
+    o.active = gegl_node_get_producer (o.sink, "input", NULL);
+  }
 
   mrg_main (mrg);
   has_quit = 1;
@@ -462,12 +467,24 @@ static void on_viewer_motion (MrgEvent *e, void *data1, void *data2)
   }
 }
 
+static int node_select_hack = 0;
+static void node_press (MrgEvent *e, void *data1, void *data2)
+{
+  State *o = data2;
+  GeglNode *new_active = data1;
+
+  o->active = new_active;
+  mrg_event_stop_propagate (e);
+  node_select_hack = 1;
 
+  mrg_queue_draw (e->mrg, NULL);
+}
 
 static void on_pan_drag (MrgEvent *e, void *data1, void *data2)
 {
   State *o = data1;
-  if (e->type == MRG_CLICK)
+
+  if (e->type == MRG_DRAG_RELEASE && node_select_hack == 0)
   {
     float x = (e->x + o->u) / o->scale;
     float y = (e->y + o->v) / o->scale;
@@ -492,8 +509,9 @@ static void on_pan_drag (MrgEvent *e, void *data1, void *data2)
     o->u -= (e->delta_x );
     o->v -= (e->delta_y );
     mrg_queue_draw (e->mrg, NULL);
+    mrg_event_stop_propagate (e);
   }
-  mrg_event_stop_propagate (e);
+  node_select_hack = 0;
   drag_preview (e);
 }
 
@@ -937,16 +955,6 @@ static void draw_gegl_crop (State *o, Mrg *mrg, cairo_t *cr, GeglNode *node)
 #endif
 #if DEBUG_OP_LIST
 
-static void node_press (MrgEvent *e, void *data1, void *data2)
-{
-  State *o = data2;
-  GeglNode *new_active = data1;
-
-  o->active = new_active;
-  
-  mrg_queue_draw (e->mrg, NULL);
-}
-
 static void node_remove (MrgEvent *e, void *data1, void *data2)
 {
   State *o = data1;
@@ -1744,7 +1752,7 @@ static void ui_canvas_handling (Mrg *mrg, State *o)
   {
     case TOOL_PAN:
       cairo_rectangle (mrg_cr (mrg), 0,0, mrg_width(mrg), mrg_height(mrg));
-      mrg_listen (mrg, MRG_DRAG|MRG_CLICK, on_pan_drag, o, NULL);
+      mrg_listen (mrg, MRG_DRAG, on_pan_drag, o, NULL);
       mrg_listen (mrg, MRG_MOTION, on_viewer_motion, o, NULL);
       mrg_listen (mrg, MRG_SCROLL, scroll_cb, o, NULL);
       cairo_new_path (mrg_cr (mrg));
@@ -1765,16 +1773,6 @@ static void ui_canvas_handling (Mrg *mrg, State *o)
 }
 
 
-static void node_press (MrgEvent *e, void *data1, void *data2)
-{
-  State *o = data2;
-  GeglNode *new_active = data1;
-
-  o->active = new_active;
-  
-  mrg_queue_draw (e->mrg, NULL);
-}
-
 static void node_remove (MrgEvent *e, void *data1, void *data2)
 {
   State *o = data1;
@@ -2084,7 +2082,7 @@ static void node_down (MrgEvent *event, void *data1, void *data2)
   if (o->active == NULL)
     return;
   ref = gegl_node_get_producer (o->active, "input", NULL);
-  if (ref && ref != o->source)
+  if (ref) // && ref != o->source)
     o->active = ref;
   mrg_queue_draw (event->mrg, NULL);
 }
diff --git a/gegl/gegl-config.c b/gegl/gegl-config.c
index c781e3ed0..ef705b88e 100644
--- a/gegl/gegl-config.c
+++ b/gegl/gegl-config.c
@@ -221,7 +221,7 @@ gegl_config_class_init (GeglConfigClass *klass)
                                    g_param_spec_int ("chunk-size",
                                                      "Chunk size",
                                                      "the number of pixels processed simultaneously by 
GEGL.",
-                                                     1, G_MAXINT, 512 * 1024,
+                                                     1, G_MAXINT, 1024 * 1024,
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT));
 
diff --git a/gegl/process/gegl-processor.c b/gegl/process/gegl-processor.c
index 89a4504dc..15668d758 100644
--- a/gegl/process/gegl-processor.c
+++ b/gegl/process/gegl-processor.c
@@ -142,7 +142,7 @@ gegl_processor_init (GeglProcessor *processor)
   processor->context          = NULL;
   processor->queued_region    = NULL;
   processor->dirty_rectangles = NULL;
-  processor->chunk_size       = 128 * 128;
+  //processor->chunk_size       = 128 * 128;
 }
 
 static void
@@ -428,7 +428,7 @@ static gboolean
 render_rectangle (GeglProcessor *processor)
 {
   gboolean    buffered;
-  const gint  max_area = processor->chunk_size * (1<<processor->level) * (1<<processor->level);
+  const gint  max_area = processor->chunk_size * (1<<processor->level) * (1<<processor->level) * 
gegl_config_threads();
   GeglCache  *cache    = NULL;
   const Babl *format   = NULL;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]