[gimp] app: avoid starting the chunk renderer while finishing drawing a projection



commit 8a47b6819439d16c140c40fbb14f95ad6ede0d3a
Author: Ell <ell_se yahoo com>
Date:   Wed Nov 28 12:59:10 2018 -0500

    app: avoid starting the chunk renderer while finishing drawing a projection
    
    In gimp_projection_finish_draw(), make sure we don't accidentally
    re-start the chunk renderer idle source while running the remaining
    iterations, in case the chunk height changes, and we need to reinit
    the renderer state.

 app/core/gimpprojection.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 2a8264a9d8..9cfd9488f5 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -185,7 +185,8 @@ static void        gimp_projection_chunk_render_start    (GimpProjection  *proj)
 static void        gimp_projection_chunk_render_stop     (GimpProjection  *proj);
 static gboolean    gimp_projection_chunk_render_callback (gpointer         data);
 static void        gimp_projection_chunk_render_init     (GimpProjection  *proj);
-static void        gimp_projection_chunk_render_reinit   (GimpProjection  *proj);
+static void        gimp_projection_chunk_render_reinit   (GimpProjection  *proj,
+                                                          gboolean         assume_running);
 static gboolean    gimp_projection_chunk_render_iteration(GimpProjection  *proj,
                                                           gboolean         chunk);
 static gboolean    gimp_projection_chunk_render_next_area(GimpProjection  *proj);
@@ -613,7 +614,7 @@ gimp_projection_set_priority_rect (GimpProjection *proj,
       proj->priv->priority_rect = rect;
 
       if (proj->priv->chunk_render.idle_id)
-        gimp_projection_chunk_render_reinit (proj);
+        gimp_projection_chunk_render_reinit (proj, FALSE);
     }
 }
 
@@ -909,11 +910,12 @@ gimp_projection_chunk_render_init (GimpProjection *proj)
   chunk_render->target_n_pixels = GIMP_PROJECTION_CHUNK_WIDTH *
                                   GIMP_PROJECTION_CHUNK_HEIGHT;
 
-  gimp_projection_chunk_render_reinit (proj);
+  gimp_projection_chunk_render_reinit (proj, FALSE);
 }
 
 static void
-gimp_projection_chunk_render_reinit (GimpProjection *proj)
+gimp_projection_chunk_render_reinit (GimpProjection *proj,
+                                     gboolean        assume_running)
 {
   GimpProjectionChunkRender *chunk_render = &proj->priv->chunk_render;
 
@@ -939,7 +941,7 @@ gimp_projection_chunk_render_reinit (GimpProjection *proj)
    * its unrendered area with the update_areas list, and make it start
    * work on the next unrendered area in the list.
    */
-  if (chunk_render->idle_id)
+  if (chunk_render->idle_id || assume_running)
     {
       cairo_rectangle_int_t rect;
       gint                  work_h = 0;
@@ -1047,7 +1049,7 @@ gimp_projection_chunk_render_iteration (GimpProjection *proj,
        * current area, so that we're back at the beginning of a row
        */
       if (work_x != chunk_render->x)
-        gimp_projection_chunk_render_reinit (proj);
+        gimp_projection_chunk_render_reinit (proj, TRUE);
 
       chunk_render->work_height = work_h;
     }


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