[gimp] app: add gimp_projection_{get,set}_priority()



commit 1a2c0e8198307a8d710826d93cc6f68b0f901d2b
Author: Ell <ell_se yahoo com>
Date:   Sat Dec 2 09:48:14 2017 -0500

    app: add gimp_projection_{get,set}_priority()
    
    ... which control the priority of the projection's idle source.
    
    The projection's priority is specified relatively to
    GIMP_PRIORITY_PROJECTION_IDLE (i.e., a priority of 1 results in an
    idle source with priority GIMP_PRIORITY_PROJECTION_IDLE + 1, etc.)

 app/core/gimpprojection.c |   21 ++++++++++++++++++++-
 app/core/gimpprojection.h |    4 ++++
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 4d1f8cd..56c5635 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -91,6 +91,8 @@ struct _GimpProjectionPrivate
   GeglBuffer                *buffer;
   GimpTileHandlerValidate   *validate_handler;
 
+  gint                       priority;
+
   cairo_region_t            *update_region;
   GimpProjectionChunkRender  chunk_render;
   cairo_rectangle_int_t      priority_rect;
@@ -504,6 +506,23 @@ gimp_projection_new (GimpProjectable *projectable)
 }
 
 void
+gimp_projection_set_priority (GimpProjection *proj,
+                              gint            priority)
+{
+  g_return_if_fail (GIMP_IS_PROJECTION (proj));
+
+  proj->priv->priority = priority;
+}
+
+gint
+gimp_projection_get_priority (GimpProjection *proj)
+{
+  g_return_val_if_fail (GIMP_IS_PROJECTION (proj), 0);
+
+  return proj->priv->priority;
+}
+
+void
 gimp_projection_set_priority_rect (GimpProjection *proj,
                                    gint            x,
                                    gint            y,
@@ -726,7 +745,7 @@ gimp_projection_chunk_render_start (GimpProjection *proj)
   g_return_if_fail (proj->priv->chunk_render.idle_id == 0);
 
   proj->priv->chunk_render.idle_id =
-    g_idle_add_full (GIMP_PRIORITY_PROJECTION_IDLE,
+    g_idle_add_full (GIMP_PRIORITY_PROJECTION_IDLE + proj->priv->priority,
                      gimp_projection_chunk_render_callback, proj,
                      NULL);
 }
diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h
index 79f8a77..ca64373 100644
--- a/app/core/gimpprojection.h
+++ b/app/core/gimpprojection.h
@@ -57,6 +57,10 @@ GType            gimp_projection_get_type          (void) G_GNUC_CONST;
 
 GimpProjection * gimp_projection_new               (GimpProjectable   *projectable);
 
+void             gimp_projection_set_priority      (GimpProjection    *projection,
+                                                    gint               priority);
+gint             gimp_projection_get_priority      (GimpProjection    *projection);
+
 void             gimp_projection_set_priority_rect (GimpProjection    *proj,
                                                     gint               x,
                                                     gint               y,


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