[gimp] app: add gimp_projection_stop_rendering()



commit 3795c597ba1fc2c0f15264be422350c176b6af24
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jun 29 23:57:22 2014 +0200

    app: add gimp_projection_stop_rendering()
    
    which stops a running chunk renderer and moves its remaining
    unrendered region back to the projection's dirty region.

 app/core/gimpprojection.c |   46 ++++++++++++++++++++++++++++++++++++++++++++-
 app/core/gimpprojection.h |    2 +
 2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 675e979..de481e1 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -480,7 +480,7 @@ gimp_projection_set_priority_rect (GimpProjection *proj,
 {
   cairo_rectangle_int_t rect;
   gint                  off_x, off_y;
-  gint width, height;
+  gint                  width, height;
 
   g_return_if_fail (GIMP_IS_PROJECTION (proj));
 
@@ -506,6 +506,50 @@ gimp_projection_set_priority_rect (GimpProjection *proj,
 }
 
 void
+gimp_projection_stop_rendering (GimpProjection *proj)
+{
+  GimpProjectionChunkRender *chunk_render;
+  cairo_rectangle_int_t      rect;
+
+  g_return_if_fail (GIMP_IS_PROJECTION (proj));
+
+  chunk_render = &proj->priv->chunk_render;
+
+  if (! chunk_render->idle_id)
+    return;
+
+  if (chunk_render->update_region)
+    {
+      if (proj->priv->update_region)
+        {
+          cairo_region_union (proj->priv->update_region,
+                              chunk_render->update_region);
+        }
+      else
+        {
+          proj->priv->update_region =
+            cairo_region_copy (chunk_render->update_region);
+        }
+
+      cairo_region_destroy (chunk_render->update_region);
+      chunk_render->update_region = NULL;
+    }
+
+  rect.x      = chunk_render->x;
+  rect.y      = chunk_render->work_y;
+  rect.width  = chunk_render->width;
+  rect.height = chunk_render->height - (chunk_render->work_y - chunk_render->y);
+
+  /* FIXME this is too much, the entire current row */
+  if (proj->priv->update_region)
+    cairo_region_union_rectangle (proj->priv->update_region, &rect);
+  else
+    proj->priv->update_region = cairo_region_create_rectangle (&rect);
+
+  gimp_projection_chunk_render_stop (proj);
+}
+
+void
 gimp_projection_flush (GimpProjection *proj)
 {
   g_return_if_fail (GIMP_IS_PROJECTION (proj));
diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h
index 9a7e484..79f8a77 100644
--- a/app/core/gimpprojection.h
+++ b/app/core/gimpprojection.h
@@ -63,6 +63,8 @@ void             gimp_projection_set_priority_rect (GimpProjection    *proj,
                                                     gint               width,
                                                     gint               height);
 
+void             gimp_projection_stop_rendering    (GimpProjection    *proj);
+
 void             gimp_projection_flush             (GimpProjection    *proj);
 void             gimp_projection_flush_now         (GimpProjection    *proj);
 void             gimp_projection_finish_draw       (GimpProjection    *proj);


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