Commit Graph

22244 Commits

Author SHA1 Message Date
Ell 3afdd7c5c2 app: in GimpDrawable::set_buffer(), take bounds rect instead of offset only
In GimpDrawable::set_buffer(), and the corresponding
gimp_drawable_set_buffer_full() function, take a bounds rectangle,
which specifies both the drawable's new offset and its new size,
instead of only taking the new offset.  In
gimp_drawable_real_set_buffer(), set the item size according to the
rect dimensions, instead of the buffer dimensions.  The rect's
width/height may be 0, in which case the buffer's dimensions are
used.

Adapt the rest of the code.

We do this in preparation for maintaining the drawable's bounding
box separately from its logical bounds, allowing the drawable
content to extend beyond its bounds.
2019-08-02 00:40:01 +03:00
Jehan 71d0251d2c app: do not assume procedures always have a run mode.
This is especially true since procedures are defined by plug-ins,
possibly third-party. So they may not have a first run mode parameter.
Also we don't want plug-ins to generate CRITICALs in the core
application.
Therefore before trying to get and/or set the run mode parameter, always
check that this first parameter exists, and if so, is it a GimpRunMode
enum?

Fixes similar errors:
> GIMP-CRITICAL: gimp_value_array_index: assertion 'index < value_array->n_values' failed

Moreover it also makes sense to allow plug-ins to not have such
parameter. What if you make a plug-in which always work in a single mode
and don't ever plan/want to make it work interactively for instance?

Lastly old Python 2 plug-ins didn't even have a run mode parameter (I
guess our old Python 2 wrapper was getting rid of it?).
2019-08-01 18:27:33 +02:00
Michael Natterer 9926e3fd96 app: forgot to add support for GP_PARAM_DEF_TYPE_UNIT to plug-in-rc.c 2019-08-01 13:02:33 +02:00
Michael Natterer 0ccb40f89b pdb, libgimp: hide more functions that have new API in gimplegacy.[ch]
Also reorder some functions in plug_in.pdb
2019-08-01 12:28:01 +02:00
Jehan ac0c3cf532 pdb: remove some formerly manually added annotations.
From the time when I was just manually editing these even in the PDB!
2019-07-31 22:56:43 +02: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
Michael Natterer 8c4f73df8d app, libgimp: add copyright notices to the new stuff, minor cleanup 2019-07-31 00:13:49 +02:00
Michael Natterer 0a02855a59 Revert "pdb, libgimp: fix some annotations in gimp.c and gimp_pdb.c."
This reverts commit b687f111f6.

We will generate annotations for all PDB wrappers automatically.
2019-07-30 20:54:53 +02:00
Jehan b687f111f6 pdb, libgimp: fix some annotations in gimp.c and gimp_pdb.c. 2019-07-30 20:42:53 +02:00
Ell 2331b88d7d app: fix #include in gimpdrawable.c
Local foo leak.
2019-07-30 21:36:38 +03:00
Ell fb679f9efa app: guarantee fully-COWed copies in more cases in paint code 2019-07-30 20:32:43 +03:00
Ell 2d80d4d138 app: use gimp_gegl_buffer_dup() everywhere
... instead of gegl_buffer_dup().
2019-07-30 20:32:41 +03:00
Ell 5798cefe1b app: add gimp_gegl_buffer_dup()
... as a drop-in replacement for gegl_buffer_dup(), which COWs all
tiles of the source buffer, including ones that aren't fully
included within buffer's extent.
2019-07-30 20:32:10 +03:00
Ell 69ce5e7e02 app: in gimp_gegl_buffer_copy(), allow tiles outside the abyss to be COWed
In gimp_gegl_buffer_copy(), assume that the area outside the abyss
is empty, and so, when the abyss policy is NONE, allow data otuside
the source/destination abyss to be copied, by temporarily modifying
the abyss.  This allows tiles that aren't fully contained within
the abyss to be COWed, unlike gegl_buffer_copy(), which has to be
more general.
2019-07-30 20:32:09 +03:00
Ell ab94251ae9 app: remove gimp_gegl_rectangle_align_to_tile_grid()
... and replace it with gegl_rectangle_align_to_buffer().
2019-07-30 20:32:08 +03:00
Michael Natterer c0fb66254e Use g_ascii_dtostr() instead of g_ascii_formatd()
The latter is broken and doesn't guarantee a decimal point with the
current bug. Also, g_ascii_dtostr() doesn't need the format parameter
and produces nicer output.
2019-07-30 15:57:36 +02:00
Michael Natterer e36028d2ac app, libgimp, libgimpbase: forgot to support GIMP_TYPE_UNIT on the wire
This commit can serve as an example how to add new types to
GimpProtocol, note that zero public API changes.
2019-07-30 15:04:06 +02:00
Michael Natterer 82dd46580b app: use g_ascii_dtostr() in plug-in-rc.c it's locale-independent 2019-07-30 14:34:50 +02:00
Jehan 9e844ae1d7 app: when interpreter not found in interpreter DB, leave shebang as-is.
In particular, if the shebang is `#!/usr/bin/env lang` and we have not
registered a specific interpreter for `lang`, the system should leave
the env tool search the right interpreter for us. We only bypass env
when we set our own explicit interpreter.

Apply this to palette-to-gradient.py plug-in.
2019-07-29 14:11:25 +02:00
Michael Natterer 0a6f157d58 app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
  GValues we use, in the same way done for GPParamDef. GPParam is now
  different from GimpParam from libgimp, pointers can't be casted any
  longer. The protocol is now completely GimpPDBArgType-free. Remove
  gp_params_destroy() from the public API.

- libgimp: add API to convert between an array of GPParams and
  GimpValueArray, the latter is now the new official API for dealing
  with procedure arguments and return values, GimpParam is cruft (the
  wire now talks with GimpPlugIn more directly than with the members
  of GimpPlugInInfo, which need additional compat conversions).

- libgimp, app: rename gimpgpparamspecs.[ch] to simply
  gimpgpparams.[ch] which is also more accurate because they now
  contain GValue functions too. The code that used to live in
  app/plug-in/plug-in-params.h is now completely in libgimp.

- app: contains no protocol compat code any longer, the only place
  that uses GimpPDBArgType is the PDB query procedure implementation,
  which also needs to change.

- app: change some forgotten int32 run-modes to enums.
2019-07-29 12:22:58 +02:00
Jehan 6b442a1ba3 app, pdb, libgimp: fix annotations of some PDB functions.
These are used in the first port of a Python plug-in which I am doing
right now.
2019-07-28 18:43:00 +02:00
Michael Natterer 32ea28b6b1 app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
  information needed for constructing all GParamSpecs we use, don't
  use GimpPDBArgType in GPProcInstall but an enum private to the wire
  protocol plus the GParamSpec's GType name. Bump the wire protocol
  version.

- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
  take care of converting between GPParamDef and GParamSpec. They
  share code as far as possible.

- Change pluginrc writing and parsing to re-use GPParamDef and the
  utility functions from gimpgpparamspecs.

- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
  the entire core uses proper GParamSpecs from the wire protocol now,
  the whole file will follow down the drain once we use a GValue
  representation on the wire too.

- In gimp_plug_in_handle_proc_install(), change the "run-mode"
  parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
  already an enum). and change all places in app/ to treat it as an
  enum value.

- plug-ins: fix cml-explorer to register correctly, a typo in
  "run-mode" was never noticed until now.

- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
  between old-style wire communication and using GParamSpec and
  GValue, it contains some functions that are subject to change or
  even removal in the next steps.

- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
  able to actually install procedures the new way.

- plug-ins: change goat-exercise to completely use the new GimpPlugIn
  and GimpProcedure API, look here to see how plug-ins will look in
  the future, of course subject to change until this is finished.

- Next: changing GPParam to transmit all information about a GValue.
2019-07-28 17:34:40 +02:00
Ell 5a500b4a12 app: use longer iteration inteval (= bigger chunks) when applyng an op
In gimp_gegl_apply_[cached_]operation(), use a longer iteration
interval (resulying in bigger chunks) when processing the op, than
the iteration interval used for rendering the projection.  In
particular, use an even longer interval when processing area
filters, since their may be particularly sensitive to the chunk
size (see, for example, issue #3711).  Likewise, use the asme
longer interval when not showing progress indication, since we
don't need to stay responsive in this case (but don't avoid
chunking altogether, to reduce the space required for intermediate
results).

This allows us to process an op faster when committing a filter,
while still remaining responsive (if overall slower) during
preview.
2019-07-28 12:10:18 +03:00
Ell f6c4e4912a app: add gimp_gegl_node_is_area_filter_operation()
... which determines if a node is an area filter operation.  If the
node is a meta op, we conservatively return TRUE, as it may involve
an area-filter op.
2019-07-28 12:10:18 +03:00
Ell a1f676aabd app: in the gradient tool, set the graph's underlying node
... to the gimp:gradient node
2019-07-28 12:10:17 +03:00
Michael Natterer d74ae12781 app: oops these two files were not meant to be pushed just yet 2019-07-26 16:02:33 +02:00
Michael Natterer 76ee0f6559 app, libgimpbase: move lots of GValue and GParamSpec types to libgimpbase
all the stuff from app/core/gimpparamspecs.[ch] that is not about
image, drawable etc IDs, these will have to go to libgimp with
different implementations than in app/.
2019-07-26 15:54:33 +02:00
Michael Natterer 5c7134f3a5 app, pdb: rename GIMP_TYPE_COLOR_ARRAY to GIMP_TYPE_RGB_ARRAY
and rename its GParamSpec too. Also, always say "foo_array" not
"fooarray".
2019-07-26 12:58:19 +02:00
Michael Natterer 6cb8a59501 app: fix gimp_value_set_drawable(), set_channel()
to work like gimp_value_set_item() and properly deal with all sorts of
drawables and channels.
2019-07-26 12:14:25 +02:00
Jehan 771d415b5f app: rename "On color" matting preview mode to "Color".
As discussed earlier with mitch and tmanni.
2019-07-25 22:44:41 +02:00
Øyvind Kolås 23ade7b80b build, app: require babl-0.1.68 or newer 2019-07-25 15:10:22 +02:00
Michael Natterer 7ddf40b78b app: make sure the display is not rotated by a very small angle
gimp_display_shell_rotate_update_transform(): reliably set rotation to
0.0 using an epsilon of 1e-3.
2019-07-25 12:48:37 +02:00
Michael Natterer ec18b969a3 app: remove gimp_display_shell_filter_new(), it's empty and useless 2019-07-25 09:55:55 +02:00
Michael Natterer 42a7d17d1a app: add missing include to gimpdisplayshell-filter.c 2019-07-25 09:15:07 +02:00
Michael Natterer 8bd4a4fac9 pdb: fix typo in the gimp-context-set-line-dash-pattern docs 2019-07-24 01:57:43 +02:00
Ell e92732f7cf app: add assigned-threads variable to the dashboard
Add an assigned-threads variable to the dashboard's misc group,
showing the number of worker threads which currently have work
assigned.  See commit
gegl@fc532f06773bd292c86abee31ac18f62e26d39df.
2019-07-23 17:15:15 +03:00
Michael Natterer 696691efbd app: fix tests by using the right value in sessionrc-expected-multi-window
Apparently GTK3 is more reliable when it comes to remembering window sizes.
2019-07-23 13:16:23 +02:00
Ell ebb3ec4925 app: reduce time complexity of layer-group translation
When translating a layer group, avoid separately updating the
original area of the child layers before translating them (as per
the fix to issue #3484), as this results in quadratic time
complexity w.r.t. to the maximal subgroup nesting level.  Instead,
simply defer the updating of the group's offset until *after*
translating the child layers, so that their original area isn't
clipped by the parent, while their new area is still properly
updated even if the parent's size changes (see comment in code).
2019-07-23 10:55:54 +03:00
Jehan 5d2dbfe2e8 app: gdk_threads_(enter|leave)() deprecated since GDK 3.6.
There are no replacements. Just we must make sure that all GTK+/GDK
calls are run from the main thread, which is already what we were doing.

Actually I don't even think these were doing anything as we were not
calling gdk_threads_init() so the default lock functions were not set
anyway. These were just bogus calls.
2019-07-22 11:25:24 +02:00
Michael Natterer d88b90d026 app: fix render cache artifacts when resizing the canvas
Since introducing gimp_display_shell_canvas_tick() we were setting
shell->disp_width and shell->disp_height in the tick callback, which
was too late and caused redundant rendering and scrolling, but was
never noticed.

Now we clear the render cache and its valid region in
gimp_display_shell_canvas_size_allocate() directly and set
shell->disp_width and shell->disp_height immediately, so other places
that listen to the canvas' size-allocate get the right values.

The old size of the canvas gets to the tick callback using a small
struct as user data.
2019-07-21 18:18:31 +02:00
Ell 2cc77e6927 app: add active-thread variable to the dashboard
Add an active-thread variable to the dashboard's misc group,
showing the number of active worker threads.  See commit
gegl@6a3a6314d4d4cd668e0f6164afc0fde8b9c7c001.
2019-07-21 00:00:52 +03:00
Michael Natterer b2f660ae43 app, pdb, libgimp: remove the "plug-in precision-enabled" API and logic
There is no old way of accessing pixels any longer, all plug-ins are
now precsion-enabled.
2019-07-20 01:53:31 +02:00
Ell e22fcc8942 app: fix gradient dithering
In gimp:gradient, fix dithering to correspond to how we actually
round float values to 8-bit.  In particular, this avoids
introducing noise when a component is fixed at 0 or 1 along a
segment.
2019-07-19 21:49:57 +03:00
Michael Natterer b7cf850671 plug-ins: remove the oilify plug-in and add a PDB compat procedure 2019-07-19 17:35:13 +02:00
Michael Natterer ed64fda6e5 app: add gegl:mean-curvature-blur to Filters -> Blur 2019-07-19 14:41:19 +02:00
Jehan eca4ca8c8c app: fix wrong default value on gimp-plug-in-emboss compat proc.
Fixes:
> GIMP-CRITICAL: gimp_param_spec_int32: assertion 'default_value >= minimum && default_value <= maximum' failed
2019-07-19 11:11:34 +02:00
Michael Natterer 8a51993e3f pdb, plug-ins: remove the emboss plug-in and add a PDB compat procedure
Not for 2.10 because it looks a bit different.
2019-07-18 15:05:48 +02:00
Michael Natterer 31fc338ab0 pdb, plug-ins: remove the newsprint plug-in and add a PDB compat procedure 2019-07-18 12:52:18 +02:00
Michael Natterer ce44b04005 app: improve gegl:newsprint's GUI a lot
Add some frames, a notebook for the channels and toggles to lock all
channels' properties together.
2019-07-18 02:10:24 +02:00
Michael Natterer d718da27a8 app: add gegl:newsprint to Filters -> Distorts
and add a custom GUI constructor that does nothing special (yet).
2019-07-17 18:24:33 +02:00