Commit Graph

27 Commits

Author SHA1 Message Date
santouits 6e00a19fd0 Don't compile gimpmarshal source file many times
Also, removes gimpmarshal.h from a source file that didn't need it.
2020-09-13 18:13:29 +03:00
Ell faf6acfb67 app: add "chunked" parameter to gimp_tile_handler_validate_validate()
... which allows validating the area in chunks, instead of in a
single step.
2020-03-14 13:54:57 +02:00
Ell fcc1c3d380 app: suspend tile validation while setting extent of validate-handler buffer
In gimp_tile_handler_validate_buffer_set_extent(), suspend tile
validation while calling gimp_gegl_buffer_set_extent(), so that if
the call triggers clearing of partial tiles, these tiles don't get
unnecessarily validated.
2020-01-18 12:43:06 +02:00
Ell d39822bcd7 app: in GimpTileHandlerValidate, fix tile-data pointer for negative coords
In gimp_tile_handler_validate_validate_tile(), when validating a
partial tile with negative coordinates, make sure to adjust the
result of the modulo when calculating the tile-realtive coordinates
so that they're non-negative, to fix the tile-data pointer offset.
2020-01-16 01:58:55 +02:00
Ell 3ea391602e app: add GimpTileHandlerValidate::invalidated signal
Add a new GimpTileHandlerValidate::invalidated signal, which is
emitted when a region of the buffer is invalidated.  This would
allow us to properly invalidate the graph in response; this
normally happens in response to GeglBuffer::changed, but this
signal is not emitted when a region is merely invalidated.
2020-01-15 21:50:11 +02:00
Ell ba6040bbcd app: allow calling gimp_tile_handler_validate_validate() with a NULL rect
... and validate the entire buffer.
2020-01-15 21:50:11 +02:00
Ell b4ee9ff055 app: add gimp_tile_handler_validate_buffer_set_extent()
... which sets the extent of a buffer with an assigned
GimpTileHandlerValidate, clipping the dirty region to the new
extent.
2019-08-13 17:44:10 +03:00
Michael Natterer 63695b4b21 libgimbase: merge gimpparam.h into gimpparamspecs.h
which means that it's now included normally via gimpbase.h
and not any longer via gimpbasetypes.h which we only did out
of lazyness. A *lot* of files in libgimp* and app/ now need to
2019-07-31 10:16:21 +02:00
Ell bb7f61c919 app: use gimp_gegl_buffer_copy() in various places
... instead of gegl_buffer_copy().  The former parallelizes the
format conversion.
2019-03-06 05:59:57 -05:00
Ell f4750a0ae7 app: in gimp_tile_handler_validate_buffer_copy(), temporarily remove source handler
In gimp_tile_handler_validate_buffer_copy(), temporarily remove the
source buffer's validate handler, is exists, so that the subsequent
gegl_buffer_copy() can use fast tile copying, using the TILE_COPY
command.  GEGL currently only uses TILE_COPY when the source buffer
doesn't have any user-provided tile handlers.
2019-01-12 04:53:02 -05:00
Ell 78ed038fca app: in GimpTileHandlerValidate, avoid fetching/copying whole tiles
In GimpTileHandlerValidate, when rendering a whole tile in respone
to a TILE_GET command, use gegl_tile_handler_get_tile() to get the
tile without preserving its data, so that we avoid unnecessarily
fetching the tile from storage, or copying its data during
uncloning.
2019-01-02 07:41:34 -05:00
Ell 82a60997d4 app: add gimp_tile_handler_validate_validate()
... which validates a given rectangle directly into the buffer,
possibly intersecting it with the dirty region.  This is more
efficient than either invalidating, un-invalidating, and rendering
a given rect, as we're doing in GimpProjection, or validating the
buffer tile-by-tile, as we're doing in gimp:buffer-source-validate.
2018-11-28 13:25:34 -05:00
Ell 0ad41cfe0c app: add GimpTileHandlerValidate::validate_buffer() vfunc
... which is similar to the ::validate() vfunc, however, it should
render the result to the provided GeglBuffer, instead of to a
memory buffer.

Provide a default implementation, which uses
gegl_node_blit_buffer() if the default ::validate() implementation
is used, or, otherwise, calls uses
gegl_buffer_linear_{open,close}(), and passes the returned memory
buffer to ::validate().
2018-11-28 13:25:33 -05:00
Ell 5a623fc54b app: add GimpTileHandlerValidate::{begin,end}_validate() vfuncs
Add begin_validate() and end_validate() virtual functions, and
corresponding free functions, to GimpTileHandlerValidate.  These
functions are called before/after validation happens, and should
perform any necessary steps to prepare for validation.  The default
implementation suspends validation on tile access, so that the
assigned buffer may be accessed without causing validation.

Implement the new functions in GimpTileHandlerProjectable, by
calling gimp_projectable_begin_render() and
gimp_projectable_end_render(), respectively, instead of calling
these functions in the ::validate() implementation (which, in turn,
allows us to use the default ::validate() implementation.)

In GimpProjection, use the new functions in place of
gimp_projectable_{begin,end}_render().
2018-11-28 13:25:33 -05:00
Ell eeed4778a2 app: add gimp_tile_handler_validate_buffer_copy()
Add gimp_tile_handler_validate_buffer_copy(), which can be used
instead of gegl_buffer_copy(), to copy a (subregion of a) source
buffer to a destination buffer with a GimpTileHandlerValidate,
uninvalidating, and avoiding unnecessarily rendering, the
affected region.  Additionally, if the source buffer also uses a
GimpTileHandlerValidate, the relevant parts of the source buffer's
dirty region are copied to the destination's dirty region as well.
2018-08-03 13:50:13 -04:00
Ell 12530e21b2 app: add gimp_tile_handler_validate_unassign()
... which should be used to properly remove a
GimpTileHandlerValidate from a buffer, instead of using
gegl_buffer_remove_handler() directly.

Use gimp_tile_handler_validate_unassign(), instead of
gegl_buffer_remove_handler(), in gimp_projection_free_buffer().
2018-08-03 13:50:13 -04:00
Ell e1e4ba9c8b app: in GimpTileHandlerValidate, clear data when allocating tile
In GimpTileHandlerValidate, when allocating a new tile upon a
TILE_GET command, but not rendering the whole tile, clear the tile
data before rendering, so that the unrendered regions of the tile
contain zeros, rather than junk.
2018-08-03 13:50:13 -04:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer cad72b1432 app: remove unused variable in gimp_tile_handler_validate_command() 2018-04-02 23:23:54 +02:00
Ell 4acdc7392a app: use gegl_tile_handler_damage_rect() in TileHandlerValidate
Use the recently-added gegl_tile_handler_damage_rect() function
during GimpTileHandlerValidate invalidation, instead of manually
voiding the tile pyramid.  This function avoids voiding mipmapped
tiles entirely when only a subarea of the tile needs to be redrawn.

See GEGL commit 3210f4ffc3c569a2acd9483811cb141070112bc6.
2018-04-02 16:47:45 -04:00
Ell dec2375a26 app: add gimp:buffer-source-validate operation
gimp:buffer-source-validate is a drop-in replacement for
gegl:buffer-source, however, if the attached buffer has a
validating tile-handler, it makes sure the required region is
validated during process().  This avoids a situation in which
validation happens in different worker threads at the same time
during the processing of a succeeding operation; since validation
is protected by the buffer's tile-storage mutex, this can result in
either a deadlock (currently), or an effective fallback to single-
threaded processing.
2017-12-04 16:02:41 -05:00
Ell eeddd13209 Revert "app: make GimpTileHandlerValidate thread safe"
This reverts commit 4bd118ec8a.

The mutex introduced by the above commit should no longer be
necessary, after GEGL commit
8b034c437b0162b26f85eb80867914977ac3cf57.
2017-11-24 14:10:47 -05:00
Ell 4bd118ec8a app: make GimpTileHandlerValidate thread safe
Use a mutex to protect the call to
gimp_tile_handler_validate_validate() while fetching tiles, since
it's nowhere near thread safe.
2017-11-15 11:51:58 -05:00
Michael Natterer 572063765f app: use "const GeglRectangle*" in the GimpTileHandlerValidate API 2017-08-05 15:49:06 +02:00
Michael Natterer 12f920d8bf app: change GimpTileHandlerValidate's API to use GeglRectangle
instead of x, y, width, height.
2017-08-05 15:43:41 +02:00
Michael Natterer 0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
Michael Natterer 8c6e890835 app: rename GimpTileHandlerProjection to GimpTileHandlerValidate
Add virtual function validate() so subclasses can construct arbitrary
buffers on-the-fly. The default implementation blits from the
projection graph like before. Add boolean property "whole-tile" which
allows for switching between always validating entire tiles, and
validating the parts of the tile that are actually dirty.
2015-03-15 22:09:04 +01:00