Commit dac9bfe3 authored by Ell's avatar Ell

app: add "direct" parameter to gimp_projection_flush_now()

Add a boolean "direct" parameter to gimp_projection_flush_now(),
which specifies if the projection buffer should only be invalidated
(FALSE), or rendered directly (TRUE).

Pass TRUE when flushing the projection during painting, so that the
affected regions are rendered in a single step, instead of tile-by-
tile.  We previously only invalidated the projection buffer, but
since we synchronously flush the display right after that, the
invalidated regions would still get rendered, albeit less

Likewise, pass TRUE when benchmarking the projection through the
debug action, and avoid flushing the display, to more accurately
measure the render time.
parent 62aae3f3
......@@ -293,15 +293,15 @@ debug_benchmark_projection (GimpDisplay *display)
GimpProjection *projection = gimp_image_get_projection (image);
gimp_projection_stop_rendering (projection);
gimp_image_invalidate (image,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
gimp_projection_flush_now (projection);
gimp_display_flush_now (display);
gimp_projection_flush_now (projection, TRUE);
GIMP_TIMER_END ("Validation of the entire projection");
......@@ -180,7 +180,8 @@ static void gimp_projection_add_update_area (GimpProjection *proj,
gint w,
gint h);
static void gimp_projection_flush_whenever (GimpProjection *proj,
gboolean now);
gboolean now,
gboolean direct);
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);
......@@ -414,7 +415,7 @@ gimp_projection_pickable_flush (GimpPickable *pickable)
gimp_projection_get_buffer (pickable);
gimp_projection_finish_draw (proj);
gimp_projection_flush_now (proj);
gimp_projection_flush_now (proj, FALSE);
if (proj->priv->invalidate_preview)
......@@ -667,16 +668,17 @@ gimp_projection_flush (GimpProjection *proj)
g_return_if_fail (GIMP_IS_PROJECTION (proj));
/* Construct in chunks */
gimp_projection_flush_whenever (proj, FALSE);
gimp_projection_flush_whenever (proj, FALSE, FALSE);
gimp_projection_flush_now (GimpProjection *proj)
gimp_projection_flush_now (GimpProjection *proj,
gboolean direct)
g_return_if_fail (GIMP_IS_PROJECTION (proj));
/* Construct NOW */
gimp_projection_flush_whenever (proj, TRUE);
gimp_projection_flush_whenever (proj, TRUE, direct);
......@@ -780,7 +782,8 @@ gimp_projection_add_update_area (GimpProjection *proj,
static void
gimp_projection_flush_whenever (GimpProjection *proj,
gboolean now)
gboolean now,
gboolean direct)
if (! proj->priv->buffer)
......@@ -800,7 +803,7 @@ gimp_projection_flush_whenever (GimpProjection *proj,
i, &rect);
gimp_projection_paint_area (proj,
FALSE, /* sic! */
......@@ -1050,7 +1053,7 @@ gimp_projection_chunk_render_iteration (GimpProjection *proj,
chunk_render->work_height = work_h;
gimp_projection_paint_area (proj, TRUE /* sic! */,
gimp_projection_paint_area (proj, TRUE,
work_x, work_y, work_w, work_h);
chunk_render->n_pixels += work_w * work_h;
......@@ -71,7 +71,8 @@ void gimp_projection_set_priority_rect (GimpProjection *proj,
void gimp_projection_stop_rendering (GimpProjection *proj);
void gimp_projection_flush (GimpProjection *proj);
void gimp_projection_flush_now (GimpProjection *proj);
void gimp_projection_flush_now (GimpProjection *proj,
gboolean direct);
void gimp_projection_finish_draw (GimpProjection *proj);
gint64 gimp_projection_estimate_memsize (GimpImageBaseType type,
......@@ -187,7 +187,7 @@ gimp_paint_tool_paint_timeout (GimpPaintTool *paint_tool)
gimp_draw_tool_pause (draw_tool);
gimp_projection_flush_now (gimp_image_get_projection (image));
gimp_projection_flush_now (gimp_image_get_projection (image), TRUE);
gimp_display_flush_now (display);
gimp_draw_tool_resume (draw_tool);
......@@ -326,7 +326,7 @@ gimp_paint_tool_paint_start (GimpPaintTool *paint_tool,
gimp_projection_flush_now (gimp_image_get_projection (image));
gimp_projection_flush_now (gimp_image_get_projection (image), TRUE);
gimp_display_flush_now (display);
/* Start the display update timeout */
......@@ -475,7 +475,7 @@ gimp_paint_tool_paint_push (GimpPaintTool *paint_tool,
func (paint_tool, data);
gimp_projection_flush_now (gimp_image_get_projection (image));
gimp_projection_flush_now (gimp_image_get_projection (image), TRUE);
gimp_display_flush_now (display);
gimp_draw_tool_resume (draw_tool);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment