[gimp/wip/passthrough: 9/14] app: add gimp_projectable_{begin, end}_render()



commit e6d5472e39624159ac660282702c351e9598eb35
Author: Ell <ell_se yahoo com>
Date:   Sat Apr 22 14:12:20 2017 -0400

    app: add gimp_projectable_{begin,end}_render()
    
    In pass-through mode, the group layer-stack's input is connected to
    the backdrop.  However, when rendering the group's projection, we
    want to render the stack independently of the backdrop.
    Unfortunately, we can't use the stack's graph as a subgraph of two
    different graphs.
    
    To work around that, the next few commits add a mechanism for a
    projectable to be notified before and after its graph is being
    rendered.  We use this mechanism to disconnect the stack's graph
    from the backdrop before rendering the projection, and reconnect
    it afterwards.  Yep, it's ugly, but it's better than having to
    maintain n copies of (each node of) the graph (each nesting level
    requires an extra copy.)
    
    This commit adds {begin,end}_render() functions to GimpProjectable.
    These functions should be called right before/after rendering the
    projectable's graph.

 app/core/gimpprojectable.c |   26 ++++++++++++++++++++++++++
 app/core/gimpprojectable.h |    4 ++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpprojectable.c b/app/core/gimpprojectable.c
index c5ae3ef..5e6eef2 100644
--- a/app/core/gimpprojectable.c
+++ b/app/core/gimpprojectable.c
@@ -236,6 +236,32 @@ gimp_projectable_get_graph (GimpProjectable *projectable)
 }
 
 void
+gimp_projectable_begin_render (GimpProjectable *projectable)
+{
+  GimpProjectableInterface *iface;
+
+  g_return_if_fail (GIMP_IS_PROJECTABLE (projectable));
+
+  iface = GIMP_PROJECTABLE_GET_INTERFACE (projectable);
+
+  if (iface->begin_render)
+    iface->begin_render (projectable);
+}
+
+void
+gimp_projectable_end_render (GimpProjectable *projectable)
+{
+  GimpProjectableInterface *iface;
+
+  g_return_if_fail (GIMP_IS_PROJECTABLE (projectable));
+
+  iface = GIMP_PROJECTABLE_GET_INTERFACE (projectable);
+
+  if (iface->end_render)
+    iface->end_render (projectable);
+}
+
+void
 gimp_projectable_invalidate_preview (GimpProjectable *projectable)
 {
   GimpProjectableInterface *iface;
diff --git a/app/core/gimpprojectable.h b/app/core/gimpprojectable.h
index 09bcc29..38b8974 100644
--- a/app/core/gimpprojectable.h
+++ b/app/core/gimpprojectable.h
@@ -54,6 +54,8 @@ struct _GimpProjectableInterface
                                        gint            *width,
                                        gint            *height);
   GeglNode   * (* get_graph)          (GimpProjectable *projectable);
+  void         (* begin_render)       (GimpProjectable *projectable);
+  void         (* end_render)         (GimpProjectable *projectable);
   void         (* invalidate_preview) (GimpProjectable *projectable);
 };
 
@@ -78,6 +80,8 @@ void         gimp_projectable_get_size           (GimpProjectable *projectable,
                                                   gint            *width,
                                                   gint            *height);
 GeglNode   * gimp_projectable_get_graph          (GimpProjectable *projectable);
+void         gimp_projectable_begin_render       (GimpProjectable *projectable);
+void         gimp_projectable_end_render         (GimpProjectable *projectable);
 void         gimp_projectable_invalidate_preview (GimpProjectable *projectable);
 
 


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