Commit Graph

37 Commits

Author SHA1 Message Date
Jehan 49e534247a app, libgimp*, pdb, plug-ins: use g_memdup2() instead of g_memdup()
Since it appeared with GLib 2.68.0, we could not change this until we
bumped the dependency which has only become possible a few days ago
(since Debian testing is our baseline for dependency bumps). Cf.
previous commit.

As this is a drop-in replacement (just a guint parameter changed to
gsize to avoid integer overflow), search-and-replace with:

> sed -i 's/g_memdup\>/g_memdup2/g' `grep -rIl 'g_memdup\>' *`

… followed by a few manual alignment tweaks when necessary.

This gets rid of the many deprecation warnings which we had lately when
building with a recent GLib version.
2021-08-26 17:32:09 +02:00
Marie-P c112a55958 libgimp*, plug-ins: fix some warnings 2021-05-24 20:36:31 +00:00
Jehan ca8bc2bc1d app, libgimp, pdb, plug-ins: more functions moved to get|set().
The gimp_drawable_type() is an issue though as gimp_drawable_get_type()
is already defined as a common GObject API.
Though I'm actually wondering if GimpImageType is well called. Rather
than Type, shouldn't we go with ColorModel?

sed -i 's/\<gimp_drawable_bpp\>/gimp_drawable_get_bpp/g' "$@"
sed -i 's/\<gimp_drawable_width\>/gimp_drawable_get_width/g' "$@"
sed -i 's/\<gimp_drawable_height\>/gimp_drawable_get_height/g' "$@"
sed -i 's/\<gimp_drawable_offsets\>/gimp_drawable_get_offsets/g' "$@"
2021-04-06 14:34:31 +02:00
Michael Natterer a351ce9126 Remove the entire old plug-in interface 2019-09-04 00:03:12 +02:00
Michael Natterer bba67bf6cc libgimp: don't request tiles beyond the drawable extents
GEGL handles read/write outside of existing buffers gracefully, so
should GimpTileBackendPlugin.
2019-08-31 16:44:10 +02:00
Michael Natterer 7201d48231 Get rid of capitalized "ID" in function and variable names
and use "id" instead.
2019-08-23 22:23:23 +02:00
Jehan 3f1491e572 libgimp: update non-generated API using GimpItem/GimpDrawable/GimpLayer.
I did the same trick with GIMP_DEPRECATED_REPLACE_NEW_API macro, apart
for some minor widget API to preview drawable, which I will fix right
away in our plug-ins.
2019-08-22 15:54:36 +02:00
Michael Natterer cc5e9240d2 libgmp: move the remaining legacy code to gimplegacy, even PLUG_IN_INFO
Add gimplegacy-private.h to keep it separate from gimp-private.h.

The legacy code could now be removed and GimpPlugIn-ported plug-ins
would not notice.
2019-08-06 23:06:15 +02:00
Michael Natterer 3c001a6123 libgimp: separate legacy from GimpPlugIn wire communication
Move all old wire code to gimplegacy.c and add wire code to
GimpPlugIn, which now talks with the GIMP core all by itself.

Add some more ASSERT_NO_PLUG_IN_EXISTS assertions to gimplegacy.c and
fix new code that was still using legacy API.
2019-08-06 22:21:50 +02:00
Michael Natterer 9a027140c8 libgimp: add read- and write-channel construct properties to GimpPlugIn
and change all GimpPlugIn-based code to get the channels from the
plug-in singleton instead of from the global variables.
2019-08-06 21:29:48 +02:00
Michael Natterer 888c42fbb8 libgimpbase: remove the gimp protocol mutex and gp_lock()/gp_unlock()
The protocol is supposed to be used recursively, the locks just
deadlock in some situations. Threaded use of the wire protocol is
simply forbidden.
2019-08-04 22:42:15 +02:00
Michael Natterer ca1cb056fc libgimp: move the shm code to new private files gimp-shm.[ch]
and remove it from the public API, it should have never been
there in the first place.
2019-08-04 18:54:00 +02:00
Michael Natterer ad8dcff199 libgimp: add _gimp_plug_in_read_expect_msg()
and make the places who need it dispatch between it and
_gimp_read_expect_msg() depending on whether there is a GimpPlugIn
instance. Also clean up some includes.
2019-08-03 12:52:22 +02:00
Michael Natterer 7201be78d9 libgimp: add gimp-private.h for private stuff shared between files
instead of declaring stuff n time in various files. This also removes
gimp_read_expect_msg() as public symbol from libgimp.
2019-07-30 23:49:54 +02:00
Michael Natterer 05d552e634 libgimp: cleanup in GimpTileBackendPlugin 2019-07-20 02:43:58 +02:00
Michael Natterer 3b17c750ec libgimp: use one memcpy() between gimp and gegl tiles if possible
Only use line-by-line copying if the tiles don't have the same size.
2019-07-20 01:33:04 +02:00
Michael Natterer 7ad25c17b5 libgimp: remove the tile_mul code from GimpTileBackendPlugin
Now that everything is GEGL, the tile size of core and plug-in should
always be the same.
2019-07-20 01:16:07 +02:00
Michael Natterer aafb55fa02 libgimp: remove GimpDrawable and GimpTile
The GimpDrawable abstraction is completely gone, GimpTile is now a
small struct in gimptilebackendplugin.c.

All tile handling code is now in GimpTileBackendPlugin, the backend
functions are simply calling gimp_tile_get() and gimp_tile_put()
directly.
2019-07-20 01:02:24 +02:00
Michael Natterer 6a59ccf840 libgimp: remove GimpTile from the public API, and kill the tile cache 2019-07-19 22:49:20 +02:00
Michael Natterer 3864e9c782 libgimp: remove gimp_tile_ref() and gimp_tile_unref() from the API
and make them private to libgimp ad _gimp_tile_ref(),unref()
2019-07-19 13:20:50 +02:00
Ell 47dcd4b93a libgimp: avoid libgimp tile-cache in the plug-in tile backend
In GimpTileBackendPlugin, avoid storing read/written tiles in the
libgimp tile-cache, since caching is already done by GEGL.
2019-02-05 17:25:31 -05:00
Ell a5e2945b68 libgimp: in GimpTileBackendPlugin, change default tile multiplier to 1
In GimpTileBackendPlugin, change the default tile multiplier,
specifying the ratio between the backend tile-size, and GIMP's
tile-size, from 2 to 1.  Since we're reading/writing each GIMP tile
using a separate command anyway, using a large multiplier doesn't
provide any benefits, while it does have drawbacks.  In particular,
it reduces the chance that a write operation will affect an entire
tile, which allows us to avoid reading the tile data from GIMP.
2019-01-15 02:47:40 -05:00
Ell 5ffdb9aa41 libgimp: in GimpTileBackendPlugin, don't read tile data upon TILE_SET
Add an internal _gimp_tile_ref_noinit() function, which increases
the ref-count of a tile *without* initializing its data (in
particular, without reading its data from GIMP, or zeroing it.)
Use this function, instead of gimp_tile_ref(), when storing a tile
in GimpTileBackendPlugin, to avoid unnecessarily reading the tile
data from GIMP.
2019-01-15 02:47:38 -05:00
Ell d0ae39f017 Issue #440 - libgimp/gimptilebackendplugin.c provides no pyramid
In GimpTileBackendPlugin, return NULL when fetching z>0 tiles,
instead of simply ignoring the z coordinate, so that the mipmapped
tile is rendered locally.  Likewise, avoid storing z>0 tiles.

Note that this is suboptimal, since all the necessary level-0 tiles
need to be sent to the buffer as a result.  Ideally, we should
extend the wire protocol to handle mipmapped tiles.
2019-01-12 05:51:47 -05:00
Ell 3b0040c043 app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:39:56 -04:00
Ell 668fee966a libgimp: in GimpTileBackendPlugin, use gegl_tile_backend_command()
In the command handler of GimpTileBackendPlugin, forward unhandled
commands to gegl_tile_backend_command(), instead of asserting that
they're within range (which has already been disabled by commit
bc3b076caf).  See GEGL commit
30047e65723ebb44fcde9c6b5f60ceecb43b0895.
2018-08-19 19:46:11 -04:00
Ell bc3b076caf libgimp: disable tile command range check in plug-in tile backend
In gimp_tile_backend_plugin_command(), disable the range check for
the input tile command.  This check prevents us from adding new
tile commands to GEGL without breaking the ABI; yet, the next GEGL
release will add a new command.  We're going to have to decide what
to do about this, but for now, let's just disable the check, so
that at least GIMP 2.10.6 is compatible with newer versions of
GEGL, no matter how we end up handling this.

(cherry picked from commit 90ed3c8d3a)
2018-08-19 06:51:15 -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
Ell b6cb1d167c Bug 790631 - C plug-ins instability when processing gegl graphs ...
... with several threads

Commit d8ae581703 didn't go far
enough in protecting GimpTileBackendPlugin against race conditions.
The underlying GimpTile cache is shared across all drawables, so we
must use a common lock for all instances of GimpTileBackendPlugin,
instead of one per instance.

Do just that -- replace the per-instance mutex of
GimpTileBackendPlugin with a global one.  This makes
GimpTileBackendPlugin instances thread-safe w.r.t. themselves, and
w.r.t other GimpTileBackendPlugin instances.  However, we don't aim
to make GimpTileBackendPlugin thread-safe w.r.t. other libgimp
functions at this point, since the original API has never been
thread-safe.
2017-11-22 04:38:07 -05:00
Ell d8ae581703 libgimp: make GimpTileBackendPlugin thread safe
The entire libgimp tile code is not thread safe.  For now, do the
easy thing, and protect GimpTileBackendPlugin with a mutex.
2017-11-20 09:18:41 -05:00
Michael Natterer 1263552f24 libgimp: don't #define TILE_HEIGHT gimp_tile_width()
Fortunately, tile width and height were alyways the same.
2016-04-24 20:04:42 +02:00
Michael Natterer 7e17a1e42e libgimp: deprecate the entire legacy pixel fiddling api
which generates a gazillion warnings in plug-ins, a perfect guide
where to do porting.
2012-05-03 01:51:39 +02:00
Michael Natterer 3e0891b80c libgimp: sytle cleanup in GimpTileBackendPlugin
and use gimp_drawable_get_format() instead our own utility function.
2012-05-02 17:50:53 +02:00
Øyvind Kolås ee97c1f4ff app: correct usage of babl formats
GIMP was doing evil hacks lying to GEGL about it's pixels being in a linear
color space when they are not. This causes incorrect rendering, makes gaussian
blur misbehave etc.

The legacy projection modes should be implemented using the same 2.2 gamma
formats that are correct to specify for sRGB data. (for proper color
management in higher bitdepths; icc backend babl formats should be used.)

For the old image modes correct babl formats are:

R'G'B'A u8  -  8 bit RGB with 2.2 gamma (sRGB) with linear alpha component
R'G'B' u8   -  8 bit RGB with 2.2 gamma (sRGB)
Y'A u8      -  8 bit Grayscale with 2.2 gamma with linear alpha component
Y' u8       -  8 bit Grayscale with 2.2 gamma

Y u8        -  8 bit linear data, used for masks/channels
A u8        -  8 bit linear alpha

-----------------------------------------------

RGBA float  -     32bit floating point linear light RGB
RaGaBaA float  -  32bit floating point linear light RGB, premultiplied alpha
                  to be used for processing that needs to scale by the alpha,
                  (blurs, resampling etc)
R'G'B'A float  -  32bit floating point sRGB with gamma, to be used where
                  the result depends on being closer to perceptual when
                  processing, can be used a cheaper alternative to CIE Lab
                  based modes.

-----------------------------------------------

The legacy layer modes should use the formats with gamma 2.2 only for loading
and rendering legacy XCF files correctly, in the brave new world compositing
should most likely be done in linear light with "RGBA float" and even better
"RaGaBaA float" like GEGL does for porter duff and other compositing modes.

The ability to chose the legacy layer modes should probably be hidden from the
user unless an old .xcf has been opened.
2012-05-02 17:50:38 +02:00
Øyvind Kolås 2ff19d7087 libgimp: flush underlying drawable on gegl_buffer_flush 2012-05-02 17:46:08 +02:00
Michael Natterer efb82673de libgimp: make GimpTileBackendPlugin properly private, and some cleanup 2012-05-02 17:46:08 +02:00
Øyvind Kolås 4bdbff08d7 libgimp: add a GeglBuffer backend for plug-ins
Also added an API to get GeglBuffers for drawables, you choose whether you
get.
2012-05-02 17:46:08 +02:00