app: use {begin,end}_render() and GimpTileHandlerProjectable ...

... in GimpProjection and gimp_display_shell_render() (the latter
is not really necessary, but whatever.)
This commit is contained in:
Ell 2017-04-22 14:22:06 -04:00
parent 426bc371cd
commit 1c68617302
2 changed files with 21 additions and 4 deletions

View File

@ -30,7 +30,6 @@
#include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-utils.h"
#include "gegl/gimptilehandlervalidate.h"
#include "gimp.h"
#include "gimp-memsize.h"
@ -39,6 +38,7 @@
#include "gimppickable.h"
#include "gimpprojectable.h"
#include "gimpprojection.h"
#include "gimptilehandlerprojectable.h"
#include "gimp-log.h"
#include "gimp-priorities.h"
@ -389,12 +389,10 @@ gimp_projection_get_buffer (GimpPickable *pickable)
if (! proj->priv->buffer)
{
GeglNode *graph;
const Babl *format;
gint width;
gint height;
graph = gimp_projectable_get_graph (proj->priv->projectable);
format = gimp_projection_get_format (GIMP_PICKABLE (proj));
gimp_projectable_get_size (proj->priv->projectable, &width, &height);
@ -402,7 +400,8 @@ gimp_projection_get_buffer (GimpPickable *pickable)
format);
proj->priv->validate_handler =
GIMP_TILE_HANDLER_VALIDATE (gimp_tile_handler_validate_new (graph));
GIMP_TILE_HANDLER_VALIDATE (
gimp_tile_handler_projectable_new (proj->priv->projectable));
gimp_tile_handler_validate_assign (proj->priv->validate_handler,
proj->priv->buffer);
@ -608,7 +607,11 @@ gimp_projection_finish_draw (GimpProjection *proj)
{
gimp_projection_chunk_render_stop (proj);
gimp_projectable_begin_render (proj->priv->projectable);
while (gimp_projection_chunk_render_iteration (proj));
gimp_projectable_end_render (proj->priv->projectable);
}
}
@ -679,6 +682,8 @@ gimp_projection_flush_whenever (GimpProjection *proj,
gint n_rects = cairo_region_num_rectangles (proj->priv->update_region);
gint i;
gimp_projectable_begin_render (proj->priv->projectable);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
@ -693,6 +698,8 @@ gimp_projection_flush_whenever (GimpProjection *proj,
rect.width,
rect.height);
}
gimp_projectable_end_render (proj->priv->projectable);
}
else /* Asynchronous */
{
@ -741,6 +748,8 @@ gimp_projection_chunk_render_callback (gpointer data)
gint chunks = 0;
gboolean retval = TRUE;
gimp_projectable_begin_render (proj->priv->projectable);
do
{
if (! gimp_projection_chunk_render_iteration (proj))
@ -756,6 +765,8 @@ gimp_projection_chunk_render_callback (gpointer data)
}
while (g_timer_elapsed (timer, NULL) < GIMP_PROJECTION_CHUNK_TIME);
gimp_projectable_end_render (proj->priv->projectable);
GIMP_LOG (PROJECTION, "%d chunks in %f seconds\n",
chunks, g_timer_elapsed (timer, NULL));
g_timer_destroy (timer);

View File

@ -89,6 +89,8 @@ gimp_display_shell_render (GimpDisplayShell *shell,
buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (image));
#ifdef USE_NODE_BLIT
node = gimp_projectable_get_graph (GIMP_PROJECTABLE (image));
gimp_projectable_begin_render (GIMP_PROJECTABLE (image));
#endif
#ifdef GIMP_DISPLAY_RENDER_ENABLE_SCALING
@ -321,6 +323,10 @@ gimp_display_shell_render (GimpDisplayShell *shell,
g_object_unref (cairo_buffer);
#ifdef USE_NODE_BLIT
gimp_projectable_end_render (GIMP_PROJECTABLE (image));
#endif
if (shell->mask)
{
if (! shell->mask_surface)