Commit graph

21467 commits

Author SHA1 Message Date
Jehan
2dc3e1813c app: make layer picking a generic modifier of the shell.
Instead of having layer picking only on paint tools with alt-click, make
it available everywhere with alt-middle click. Moving through layers is
also a way to navigate an image, so it actually makes sense to be with
other modifiers (panning, zooming, rotating), while making the feature
more generic (this is definitely useful whatever the selected tool).

(cherry picked from commit 4c337353a0)
2019-01-08 13:41:06 +01:00
Jehan
e0be9bdef2 app: alt-click to pick a layer will loop through candidate layers.
If you click on a zone filled in several visible layers, you don't
necessarily want the top layer. You may want one below. With this
change, as long as you hold alt, you will loop through all candidate
layers from top to bottom (then looping back top when reaching the
bottom).
In a first alt-click, you will always end up to the top candidate.

(cherry picked from commit 90e9eb3fca)
2019-01-08 13:41:06 +01:00
Jehan
5790c809c1 app: allow picking layer in paint tools on alt-click.
When working with a lot of layers, it is common to have to switch easily
between layers. And having to go back to the layer list is annoying and
also sometimes not practical at all when you can't find easily the right
layer. This is a first step in an experiment for such a feature, worked
together with Aryeom as advisor (and originator of the feature idea).
For now I apply this only to paint tools, though we are considering
having it as a generic modifier too, working whatever the tool. Yet we
wouldn't be able to use alt-left click (as it is used already in some
tools).
How it works is simply that in any paint tool, alt-click allows to
switch to the topmost layer having a visible pixel at the clicked
position.

(cherry picked from commit 3b59e6f61e)
2019-01-08 13:41:05 +01:00
Ell
926e28b219 app: in bucket fill tool, don't calculate line art of layer groups
... since they can't be used with the fill tool.

(cherry picked from commit 4b4fffbd0e)
2019-01-07 04:29:13 -05:00
Michael Natterer
58e266ed8b Issue #1358 - Increase default size of "extended input device dialog"...
...for a less cramped look

With a minimum width of 300 instead of 200 pixels, much less device
names are cut off and need horizontal scrolling.

(cherry picked from commit ee6b629fa3)
2019-01-07 00:44:36 +01:00
Ell
0f2f95d97b app: in bucket-fill tool, avoid calculating line art when not in line-art mode
In the bucket-fill tool, don't pre-calculate the line art when not
using a line-art fill area.  Also, misc. cleanup.

(cherry picked from commit 823d4a0d24)
2019-01-06 16:31:11 -05:00
Ell
fbf73bee70 app: remove gimp-scratch; replace with gegl-scratch
The scratch allocator has been moved to GEGL (commit
gegl@b99032d799dda3436ffa8c1cc28f8b0d34fb965d).  Remove gimp-
scratch, and replace all its uses with gegl-scratch.

(cherry picked from commit 889e2e26ee)
2019-01-06 07:39:52 -05:00
Michael Natterer
25983b8280 Issue #2751 - Some Translated sentences appear as Untranslated
Pass the translation context to gimp_action_group_add_*_actions() to
make action translations work.

(cherry picked from commit 55219ffaf1)
2019-01-05 02:59:12 +01:00
Ell
7fa5fbab94 app: small fix to last commit
(cherry picked from commit d39ac2a3f0)
2019-01-04 15:32:19 -05:00
Ell
a299270f8a app: in GimpHistogramEditor, don't block when creating bg histogram
In GimpHistogramEditor, when the drawable preview is frozen, don't
duplicate the main histogram as the bg histogram if calculation is
still ongoing, since this will block until histogram calculation is
complete.  In particular, this creates a noticeable stall when
beginning a paint stroke while the histogram is being calculated.

Instead, defer the creation of the bg histogram to the completion
of the calculation of the main histogram.

(cherry picked from commit 471efee769)
2019-01-04 15:18:22 -05:00
Ell
f08065b8c6 app: write floating-point vars using C locale in performance logs
When writing floating-point instrumentation variables in
performance logs, always use the C locale, rather than the current
locale.

(cherry picked from commit 626208b17c)
2019-01-04 13:04:58 -05:00
Michael Natterer
adbac2f680 Issue #2446 - DPI information is not stored in clipboard
Set the "x-dpi" and "y-dpi" options on the GdkPixbuf set on the
clipboard. There is not much more we can do, getting that value across
the clipboard is out of our control, but at least we set the vlaues
now.

(cherry picked from commit a0263f40d0)
2019-01-04 18:13:42 +01:00
Michael Natterer
8dee1276f1 pdb: deprecate gimp_get_theme_dir() and gimp_get_icon_theme_dir()
They are unused in 2.10 and master, and we do this via the plug-in
config message anyway.
2019-01-04 15:55:47 +01:00
Michael Natterer
490d565b57 Issue #2136 - On-image UI for adjusting Linear Motion Blur
Add on-canvas GUI (simple lines) for circular, linear and zoom motion
blur. The restrictions in the interaction show pretty well that there
is room for improvement here, the line is just a bit too generic, but
it's better than nothing.

(cherry picked from commit 39406b83d3)
2019-01-04 14:40:25 +01:00
Ell
5f00ee2a7d app: in GimpHistogramEditor, cancel ongoing async upon update
In gimp_histogram_editor_update(), cancel any ongoing histogram-
calculation async before restarting the idle source.  The async
will have been canceled anyway when recalculating the histogram
once the idle source is run, but we can cancel it as soon as we
know the histogram is outdated.

(cherry picked from commit 5561da87e6)
2019-01-04 08:17:43 -05:00
Ell
8142fe4d1c app: In GimpHistogram, align copied buffer region to tile rect
In gimp_histogram_calculate_async(), align the copied region of the
drawable and mask buffers to the tile grid, so that all copied
tiles are COWed.

(cherry picked from commit d56d663eaa)
2019-01-04 08:17:42 -05:00
Michael Natterer
23cc540f62 Issue #2540 - block width / height slider of the pixelize filter don't...
...have the same scaling

gimp_prop_widget_new_from_pspec(): when restricting the scale to the
actual op area for pixel-coordinate and pixel-distance properties,
only use the max value in the axis direction for pixel-coordinate; for
pixel-distance make sure we use the same value on both axes, simply
use MAX (area.width, area.height).

(cherry picked from commit 0a1ecdf4ee)
2019-01-03 22:23:24 +01:00
Michael Natterer
75682c1650 Issue #1538 - Crash when adding file to already opened image and...
...closing this image while the file is being loaded

Ref the image around all calls to file_open_layers() and
gimp_image_add_layers() so it stays around even if the user closes the
display in the meantime.

(cherry picked from commit fc4add7c2b)
2019-01-03 16:48:32 +01:00
Michael Natterer
4572da5491 Issue #2685 - Crash when distributing layers horizontally
Fix xcf-load.c to correct out-of-range item offsets (simply set them
to 0), so XCF files that are broken this way can still be recovered.

This doesn't fix the original bug, just recovering the crash images.

(cherry picked from commit b9265e7cde)
2019-01-03 15:06:36 +01:00
Michael Natterer
c4e6c3add2 app: wrap some overly long lines in gimpbucketfilltool.c
and some other pedantic style fixes.

(cherry picked from commit 292903b78d)
2019-01-02 16:35:48 +01:00
Michael Natterer
fca2e84f4f app, libgimpbase: move enum GimpBucketFillArea to the core
The whole bucket fill specific enum stuff is on its way out, so let's
keep this one out of libgimp for now until we decide how to present
line art filling in the PDB.

(cherry picked from commit 368f2e596a)
2019-01-02 15:54:20 +01:00
Ell
e666041d72 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.

(cherry picked from commit 78ed038fca)
2019-01-02 07:41:44 -05:00
Michael Natterer
a27f7c7724 Issue #1788 - Inconsistency between FG color and selected color in...
...palette views despite selected color being in the currently
selected pallette

As suggested by Massimo, changing the color comparison EPSILON in
gimppalette.c from 1e-10 to 1e-6 fixes this, and is really small
enough.

Also, generally clean up color comparison epsilons:

- use a #define, not hardcoded values for all uses of
  gimp_rgb[a]_distance()
- call the #defines RGB_EPSILON and RGBA_EPSILON
- make them all 1e-6 or larger

(cherry picked from commit abd7cbfc8d)
2019-01-02 01:53:02 +01:00
Michael Natterer
d6ca6d510e Issue #2667 - When copying a text layer, paste should create a new...
...text layer, not an image of the text

In gimp_edit_paste_get_layer(), when pasting as floating selection,
collapse the pasted layer into an ordinary layer only if it's a group
layer. There is nothing that speaks against having a floating text
layer, it works just fine.

(cherry picked from commit 8a4aacb52f)
2019-01-02 00:17:45 +01:00
Michael Natterer
0f4cbb070f configure.ac: require babl >= 0.1.61
(cherry picked from commit b24cc6e7fa)
2019-01-01 19:24:42 +01:00
Ell
d90fd01b32 app: show message when attempting to change layers while there is a floating sel.
In GimpDrawableTreeView, show an error message when attempting to
select a different drawable while the image has an active floating
selection.  In GimpLayerTreeView, also blink the editor button-row
when this happens, as a hint that the floating selection can be
committed/canceled through the buttons (we already highlight the
relevant ones.)

(cherry picked from commit 070e10eda7)
2019-01-01 09:14:31 -05:00
Ell
563036eab6 app: more optimizations to gimp_gegl_mask_bounds()
Another inner-loop logic improvement.

(cherry picked from commit 3351174ebe)
2019-01-01 06:53:35 -05:00
Ell
ae54ed2d68 app: optimize gimp_gegl_mask_bounds()
... by using the mask's native format, and improving the inner-loop
logic.

(cherry picked from commit 819a5352f6)
2019-01-01 06:34:14 -05:00
Ell
5807ca820b app: optimize gimp_gegl_mask_is_empty()
... by using the mask's native format, and gegl_memeq_zero().

(cherry picked from commit 986a298a07)
2019-01-01 06:34:14 -05:00
Michael Natterer
1c43c6f989 app: fix last gimpcursor.c commit: g_printerr() needs a newline
(cherry picked from commit 20225a2268)
2018-12-31 19:14:05 +01:00
Michael Natterer
8ed8def107 app: support cursors with a scale factor of 2 for HiDPI
If the scale factor is 2 or larger, look for cursor images named
"filename-x2.png" and use them instead. Guess HiDPI based on the
monitor resolution being > 250 ppi, ugly but so what.

Manually scale up the default cursor if there is no "x2" image, using
NEAREST interpolation, which looks better than smooth scaling on HiDPI
monitors.

Next: adding better HiDPI cursor images.

(cherry picked from commit 8ff8f1d442)
2018-12-31 16:21:34 +01:00
Michael Natterer
1706950400 app: pass a GdkWindow not GdkDisplay to gimp_cursor_new()
Preparation for adding HiDPI cursors.

(cherry picked from commit 47ff7e1467)
2018-12-31 14:08:36 +01:00
Ell
e61188e666 app: small fix to gimp_drawable_edit_fill()
(cherry picked from commit 3738ff3ffd)
2018-12-31 05:33:45 -05:00
Ell
480d2aa588 app: show error on attempt to clear/cut layer with locked alpha channel
Show an error message, and blink the layers-dialog lock-box, when
attempting to clear/cut a layer with a locked alpha channel.

(cherry picked from commit e967e5fa9e)
2018-12-31 04:40:18 -05:00
Ell
5d905d1d65 app: in gimp_drawable_edit_fill(), make trivial alpha-only fill a NOP
In gimp_drawable_edit_fill(), if the fill only affects the alpha
channel, and if the drawable has no alpha channel, or the alpha
channel is masked out, do nothing, instead of unnecessarily
performing the fill, which has no effect.

(cherry picked from commit 6384ff01b6)
2018-12-31 04:40:18 -05:00
Ell
9058e4bd75 app: in gimp_gegl_apply_cached_operation(), intersect cached rects with dest rect
In gimp_gegl_apply_cached_operation(), intersect the cached rects
with the dest rect, so that we don't unnecessarily (if not
erroneously) copy cached regions outside the dest rect to the dest
buffer.  This can happen when the op's applicator crop-rect changes
dynamically.

(cherry picked from commit d9b4ffe09e)
2018-12-30 08:06:00 -05:00
Ell
f8a5c58d41 app: in warp tool, crop filter to stroke bounds
In the warp tool, set the drawable-filter's crop area to the
combined stroke bounds, so that, when comitting the tool, only this
area is processed, instead of the entire drawable area.

(cherry picked from commit e06c4643dc)
2018-12-30 05:13:30 -05:00
Ell
a330a94b94 app: in GimpDrawableFilter, only update crop/preview area when updating whole drawable
In GimpDrawableFilter, when updating the entire filter area, only
update the crop/preview area (as set by
gimp_drawable_filter_set_{crop,preview}()), instead of the entire
drawable.

(cherry picked from commit b846ffed19)
2018-12-30 05:13:30 -05:00
Ell
05f74b6f40 app: add gimp_drawable_filter_set_crop()
Add gimp_drawable_filter_set_crop(), which allows setting an output
crop rectangle for the filter; anything outside the rectangle
doesn't get filtered.  The crop area is combined with the preview
area to determine the filtered area during preview, however, unlike
the preview area, the crop area remains in effect while committing
the filter.

Consequently, when merging a drawable filter, if the filter has a
crop, only process the cropped area.

(cherry picked from commit 5c27d14fdf)
2018-12-30 05:13:29 -05:00
Ell
81bef8cd50 app: rename gimp_applicator_set_preview() to _set_crop(); add _get_crop()
We're going to use GimpApplicator's output crop for more than just
split previews.  Rename gimp_applicator_set_preview() to
gimp_applicator_set_crop(), and add gimp_applicator_get_crop(),
which returns the output crop rectangle, or NULL if cropping is
disabled.

(cherry picked from commit 7534ae53d6)
2018-12-30 05:13:29 -05:00
Ell
0685c05cfb app: in GimpFilterTool, make region combo insensitive when selection is empty
(cherry picked from commit 093e017df8)
2018-12-29 20:55:43 -05:00
Ell
3e1a631583 app: in GimpFilterTool, show region combo for non-point ops
In GimpFilterTool, show the region combo when applying a non-point
op, as well as when applying a position-dependent point op.  The
result of non-point ops may depend on the choice of input region,
even if the op is not position-dependent.

(cherry picked from commit 7949fd9a28)
2018-12-29 20:27:46 -05:00
Ell
bb039c8401 app: use GimpDrawableFilter in gimp_drawable_apply_operation()
In gimp_drawable_apply_operation(), use a temporary
GimpDrawableFilter to apply the operation, instead of using a
shadow buffer.  This renders and composits the op directly into the
drawable buffer, avoiding an intermediate buffer, requiring less
space and speeding up processing.

(cherry picked from commit b201f73562)
2018-12-29 14:28:51 -05:00
Ell
b4c1c94db0 app: in GimpApplicator, allow enabling cache/preview after construction; remove preview cache
Remove the use_split_preview and use_result_cache parameters of
gimp_applicator_new(), and allow enabling/disabling the cache
(through gimp_applicator_set_cache()) and the preview crop (through
gimp_applicator_set_preview()) after construction.

Move the preview crop node after the result cache, and remove the
separate preview cache node.  This eliminates an extra cache
buffer, reducing the space consumed by filters, and speeds up split
preview, since the cached result now includes the output
compositing.

(cherry picked from commit ab52dc6bca)
2018-12-29 14:28:50 -05:00
Ell
c650c51cbc app: in gimp_drawable_merge_filter(), align undo rect to tile grid
In gimp_drawable_merge_filter(), align the region copied to the
undo buffer to the drawable buffer's tile grid, so that the copied
tiles are COWed.

(cherry picked from commit cba4bc4781)
2018-12-28 08:31:05 -05:00
Ell
96a16b8db7 Revert "Bug 796090 - (wrong) true-color preview of GEGL filter ops, ..."
We now perform the conversion of filter output to the drawable
format as part of the individual filter nodes (see the last few
commits), so there's no need for another conversion after the
filter stack.

This reverts commit d6e0ca5054.

(cherry picked from commit 95393722cc)
2018-12-28 03:57:35 -05:00
Ell
8415bc7d94 app: cache result of floating selections
Use an output cache for floating-selection filters, to speed up
anchoring.

(cherry picked from commit 3f45e893bf)
2018-12-28 03:56:54 -05:00
Ell
20d6db79c2 app: use drawable format as floating-sel applicator output format
Set the output format of floating-selection applicators to the
target drawable format.  We're going to remove the global
GipDrawable convert-format node, which we use to get correct
previews for indexed drawables, so that each filter now has to do
its own format conversion.

(cherry picked from commit 0560c5a6fe)
2018-12-28 03:56:54 -05:00
Ell
37b0832c2d app: in GimpDrawableFilter, use the drawable format as the cache format
In GimpDrawableFilter, set the applicator's output format to the
drawable format, so that the cache uses the drawable format, and so
copying the cached result to the drawble's buffer when comitting
the filter becomes much cheaper, and, in particular, doesn't
require reading tiles out of the swap.  This notably improves
commit speed in large images, at the expense of requiring a few
extra conversions during preview.

(cherry picked from commit 8e57ee2265)
2018-12-28 03:56:53 -05:00
Ell
ad6fff33b6 app: add gimp_applicator_set_output_format()
In GimpApplicator, add gimp_applicator_set_output_format(), which
can be used to explicitly set the format of the result.  In
particular, this allows controlling the output cache format, which
can speed up the merging of cached filters.

(cherry picked from commit b93df0311f)
2018-12-28 03:56:52 -05:00
Ell
7c1d5b7a3e app: add GimpDrawable::format-changed signal
... which is emitted when the drawable's format is changed.

(cherry picked from commit 85e454bae8)
2018-12-28 03:56:52 -05:00
Ell
13c6fe5db6 app: in GimpLineArt, use "invalidate-preview" signal of input viewable
In GimpLineArt, use the "invalidate-preview" signal of the input
viewable, instead of its "painted" or "rendered" signals, for
asynchronously computing the line art.  Subsequently, remove the
aforementioned signals from GimpDrawable and GimpProjection,
respectively.  This simplifies the code, and reduces the number of
signals.

(cherry picked from commit ef9b1f6694)
2018-12-27 17:14:34 -05:00
Ell
cbffd9dfb6 app: remove gimp_applicator_dup_apply_buffer()
... nothing uses it after last commit.

(cherry picked from commit 12e83350bf)
2018-12-27 14:01:50 -05:00
Ell
23ae869f21 app: remove "Edit -> Fade..."
This commit completely removes the "Edit -> Fade..." feature,
because...

- The main reason is that "fade" requires us to keep two buffers,
  instead of one, for each fadeable undo step, doubling (or worse,
  since the extra buffer might have higher precision than the
  drawable) the space consumed by these steps.  This has notable
  impact when editing large images.  This overhead is incurred even
  when not actually using "fade", and since it seems to be very
  rarely used, this is too wasteful.

- "Fade" is broken in 2.10: when comitting a filter, we copy the
  cached parts of the result into the apply buffer.  However, the
  result cache sits after the mode node, while the apply buffer
  should contain the result of the filter *before* the mode node,
  which can lead to wrong results in the general case.

- The same behavior can be trivially achieved "manually", by
  duplicating the layer, editing the duplicate, and changing its
  opacity/mode.

- If we really want this feature, now that most filters are GEGL
  ops, it makes more sense to just add opacity/mode options to the
  filter tool, instead of having this be a separate step.

(cherry picked from commit ed7ea51fb7)
2018-12-27 11:45:11 -05:00
Jehan
e001f344e5 app: rename and merge the spline and segment length properties...
... in GimpBucketFillOptions for the line art algorithm.

Inside GimpLineArt, there are still 2 properties, but we don't show them
anymore in the Bucket Fill tool options. One of the main reason is
probably that it's hard to differentiate their usage. One is to close
with curved lines, the other with straight segments. Yet we don't
actually have any control on one or the other. All one knows is that you
can have "holes" in your drawing of a given size and you want them
close-like for filling. Only reason I can see to have 2 types of closure
is whether you'd want to totally disable one type of closure (then you
set it to 0). But this is a very limited reason for making the options
less understandable overall, IMO.
So for the time being, let's show up only a single option which sets
both properties in GimpLineArt. As patdavid says "it makes sense as a
first pass".

Also rename the option to shorter/simpler "Maximum gap length". Thanks
to patdavid and pippin for helping on figuring out this better label!

Finally I am bumping the default for the gaps to 100px. The original
values were ok for the basic small images used in demos, but not for
real life image where it was always too short (even 100px may still be
too short actually, but much better than the 20 and 60px from before!).

(cherry picked from commit 503775a5a0)
2018-12-24 13:35:32 +01:00
Michael Natterer
769a6f73cc app: fix capitalization of the "Line Art Detection" frame
(cherry picked from commit 822f1b9090)
2018-12-22 21:08:06 +01:00
Alexandre Prokoudine
3d9ad63c34 Unified transform: enable Constraint:Scale by default 2018-12-21 01:49:44 +03:00
Ell
d70aeea550 app: improve gradient color-sampling speed
Improve the speed of gimp_gradient_get_color_at(), which is used by
gimp:gradient during processing when the gradient cache is too big,
by disabling type checking, and inlining and avoiding some function
calls.

(cherry picked from commit 93f4b18704)
2018-12-20 08:32:23 -05:00
Jehan
3ef6c2fb96 app, pdb: more gimp-2-10 only tweak for the smart-colorization.
Again some changes because of the different PDB file organization
between branches.
2018-12-19 16:25:04 +01:00
Jehan
487c01f8d1 app: fix type warning.
I missed this warning when reviewing commit a9a979b2d0.
My bad!

(cherry picked from commit 182786b4fb)
2018-12-19 16:24:50 +01:00
Jehan
ef12064655 app: allow setting line art spline and segment length to 0.
Practically it means that the algorithm won't close line art anymore
with both settings at 0. This can nevertheless still be a very useful
tool when you have a drawing style with well-closed lines. In such a
case, you will still profit from the color flooding under the line art
part of the algorithm.
Moreover with such well-closed zones from start, you don't get the
over-segmentation anymore and the threaded processing will be faster
obviously.

(cherry picked from commit 0a2d066168)
2018-12-19 16:24:23 +01:00
Jehan
2d409f2d0e Issue #2664: add a tooltip to "better compression" checkbox.
Zlib is a "better" compression in the meaning that it is a more advanced
and complex algorithm than RLE. And in most cases, it should end up in
smaller file sizes. But as any algorithm, there may be cases when the
expectations are not met (worst cases or such). That's the nature of the
maths. Still we should not make the checkbox text over-complicated (it
is not the place to teach algorithmic), yet we can at least add a small
tooltip text.

(cherry picked from commit c3ac722995)
2018-12-19 16:24:10 +01:00
Jehan
86b9738286 app: do not make line art bucket fill a GimpSelectCriterion anymore.
This was my initial choice, but the more I think about it, the less I am
sure this was the right choice. There was some common code (as I was
making a common composite bucket fill once the line art was generated),
but there is also a lot of different code and the functions were filled
of exception when we were doing a line art fill. Also though there is a
bit of color works (the way we decide whether a pixel is part of a
stroke or not, though currently this is basic grayscale threshold), this
is really not the same as other criterions. In particular this was made
obvious on the Select by Color tool where the line art criterion was
completely meaningless and would have had to be opted-out!

This commit split a bit the code. Instead of finding the line art in the
criterion list, I add a third choice to the "Fill whole selection"/"Fill
similar colors" radio. In turn I create a new GimpBucketFillArea type
with the 3 choices, and remove line art value from GimpSelectCriterion.

I am not fully happy yet of this code, as it creates a bit of duplicate
code, and I would appreciate to move some code away from gimpdrawable-*
and gimppickable-* files. This may happen later. I break the work in
pieces to not get too messy.
Also this removes access to the smart colorization from the API, but
that's probably ok as I prefer to not freeze options too early in the
process since API needs to be stable. Probably we should get a concept
of experimental API.

(cherry picked from commit cd924f453a)
2018-12-19 16:23:26 +01:00
Jehan
7ea2ca26ff Issue #2495: different code for Windows and Linux on duplicate devices.
After discussing with Mitch, it turn out commit 717c183a3e was fixing
(or rather working around) actual issues of broken device/usb stack
issues on Linux, as expected.
Nevertheless on Windows, this broke in turn many tablets (see commit
ce24e16083). Therefore we do a very ugly #ifdef to bail from duplicate
devices on Windows whereas we continue on Linux. This fix and difference
of behavior is completely empirical, rather than based on actual good
logics, so that's quite annoying, but well… not much choice here.

Also note that since we had no report of breakage on other OSes (such as
macOS/BSD), at least that I know of, I let them with the Linux code
path.

(cherry picked from commit 74a7a5d3e2)
2018-12-19 16:23:16 +01:00
Jehan
fec11389cb app: allow switching fill type with Alt even when Pattern fill selected.
Currently in bucket fill tool, the modifier was only switching fg to bg
and bg to fg, and was doing nothing when pattern was set. I make it
switch to fg as well (and remember which was the original value).

(cherry picked from commit 5a157bf1ba)
2018-12-19 16:21:37 +01:00
Jehan
a68524d43b app: reorganize the line art code inside a GimpLineArt object.
The code was too much spread out, in core and tool code, and also it was
made too specific to fill. I'll want to reuse this code at least in the
fuzzy select tool. This will avoid code duplication, and also make this
new process more self-contained and simpler to review later (the
algorithm also has a lot of settings and it is much cleaner to have them
as properties rather than passing these as parameters through many
functions).

The refactoring may not be finished; that's at least a first step.

(cherry picked from commit db18c679f3)
2018-12-19 16:14:11 +01:00
Ell
4937d1d8d3 app: use gimp_async_add_callback_for_object() in the bucket-fill tool
... for the same reason as commit
7c00cf498a.

(cherry picked from commit 6103f0e5d0)
2018-12-19 16:06:37 +01:00
Jehan
b1236403cf app: add the segment and spline max length options for line art.
We can't just hardcode this. On huge images in particular, you'll want
to increase this value.

(cherry picked from commit d71efdec20)
2018-12-19 16:05:30 +01:00
Jehan
1471da20b7 app: some code cleaning in gimplineart.
In particular, make simpler code in a few places, taking abyss value
into account (rather than checking the position).

(cherry picked from commit f7a4ce1051)
2018-12-19 16:05:05 +01:00
Jehan
21e776b911 app, pdb: more gimp-2-10 only tweak for smart colorization.
Because of the file organization of PDB different between the 2.10 and
master branches.
2018-12-19 16:05:05 +01:00
Jehan
73b348de1c app: make GimpBucketFillTool a GimpColorTool.
In particular, it allows to easily color pick. This just makes sense as
the bucket fill is definitely what one could call a "color tool", and
being able to easily change color without having to constantly switch to
color picker tool nor open a color chooser dialog is a must.

The fill type option (FG/BG/Pattern) was already mapped to the common
toggle behavior key (Ctrl on Linux), which is commonly used for
switching to color picker on paint tools. So I decided to remap the fill
type switch to GDK_MOD1_MASK (Alt on Linux) to keep consistent with
other tools (at the price of a change for anyone used to this modifier,
though I doubt it was that much used).
I also made possible to combine the 2 modifiers (so you could pick the
foreground or background color with ctrl and ctrl-alt).

(cherry picked from commit 5d4281944f)
2018-12-19 15:54:12 +01:00
Jehan
439a44a613 app: flood isolated pixels in smart colorization fill.
The smart colorization was leaving irritating single pixels in between
colorized regions, after growing and combining. So let's just flood
these. We don't flood bigger regions (and in particular don't use
gimp_gegl_apply_flood()) on purpose, because there may be small yet
actual regions inside regions which we'd want in other colors. 1-pixel
regions is the extreme case where chances that one wanted it filled are
just higher.

(cherry picked from commit 744d67939d)
2018-12-19 15:53:46 +01:00
Jehan
4fe5dc5d42 app: radius map actually not useful during smart colorization grow step.
The distance map has all the information we need already. Also we will
actually grow up to the max radius pixel (middle pixel of a stroke).
After discussing with Aryeom, we realized it was better to fill a stroke
fully (for cases of overflowing, I already added the "Maximum growing
size" property anyway).

(cherry picked from commit 6bec0bc82d)
2018-12-19 15:53:05 +01:00
Jehan
c4988efdb0 app: add possibility to antialias line art colorization.
(cherry picked from commit d2f9549c9f)
2018-12-19 15:51:27 +01:00
Jehan
53fdd19d84 app: simpler code with gegl_node_blit().
No need to go through an intermediate GeglBuffer when unneeded.

(cherry picked from commit c32b0ecc92)
2018-12-19 15:51:14 +01:00
Jehan
b00580d4b1 app: add "line-art-max-grow" property to the bucket fill options.
When flooding the line art, we may overflood it in sample merge (which
would use color in the line art computation). And if having all colors
on the same layer, this would go over other colors (making the wrong
impression that the line art leaked).
This new option is mostly to keep some control over the mask growth.
Usually a few pixels is enough for most styles of drawing (though we
could technically allow for very wide strokes).

(cherry picked from commit eb042e6c87)
2018-12-19 15:48:47 +01:00
Jehan
706fe079c2 app: make sure we reset tool modifier state before saving options.
I had this funny behavior when I was quitting GIMP with the active tool
using modifiers (for instance bucket fill). Each time I'd quit with
ctrl-q (and if the image is not dirty), the options would use the value
from the modifier state and be saved as-is. Hence at next restart, the
default value was always different!

(cherry picked from commit dd3d9ab3dd)
2018-12-19 15:48:26 +01:00
Jehan
19c1f2654e app: properly (bucket) fill created splines and segments in line art.
For this, I needed distmap of the closed version of the line art (after
splines and segments are created). This will result in invisible stroke
borders added when flooding in the end. These invisible borders will
have a thickness of 0.0, which means that flooding will stop at once
after these single pixels are filled, which makes it quick, and is
perfect since created splines and segments are 1-pixel thick anyway.
Only downside is having to run "gegl:distance-transform" a second time,
but this still stays fast.

(cherry picked from commit 5a4754f32b)
2018-12-19 15:48:15 +01:00
Jehan
e5bea42b6f app: replace gegl:watershed-transform with custom algorithm.
We don't really need to flow every line art pixel and this new
implementation is simpler (because we don't actually need over-featured
watershedding), and a lot lot faster, making the line art bucket fill
now very reactive.
For this, I am keeping the computed distance map, as well as local
thickness map around to be used when flooding the line art pixels
(basically I try to flood half the stroke thickness).

Note that there are still some issues with this new implementation as it
doesn't properly flood yet created (i.e. invisible) splines and
segments, and in particular the ones between 2 colored sections. I am
going to fix this next.

(cherry picked from commit 3467acf096)
2018-12-19 15:48:04 +01:00
Jehan
e9b8122e18 app: fix a line art leak in bucket fill tool.
Introduced in commit b4e12fbbbb:
gimp_pickable_contiguous_region_prepare_line_art_async() was running
gimp_pickable_flush(), which provokes the "rendered" signal on the
image projection when a change occured. As a result, it was calling
gimp_bucket_fill_compute_line_art() within itself and since
tool->priv->async was not set yet, none of the call were canceled. Hence
the same line art is computed twice, but one is leaked.
Make sure we block this signal handler as a solution.

(cherry picked from commit 36c885a6df)
2018-12-19 15:47:48 +01:00
Jehan
2934293664 app: priority map now unneeded for gegl:watershed-transform.
This commit is based on GEGL master as I just made the auxiliary buffer
of gegl:watershed-transform optional for basic cases.
It doesn't necessarily makes the whole operation that much faster
according to my tests, but it makes the code simpler as creating this
priority map was quite unnecessary.

(cherry picked from commit 963eef8207)
2018-12-19 15:47:34 +01:00
Ell
3c0f1307cc app: add gimp_pickable_contiguous_region_prepare_line_art_async() ...
... and use in bucket-fill tool

Add gimp_pickable_contiguous_region_prepare_line_art_async(), which
computes a line-art asynchronously, and use it in the bucket-fill
tool, instead of having the tool create the async op.

This allows the async to keep running even after the pickable dies,
since we only need the pickable's buffer, and not the pickable
itself.  Previously, we reffed the pickable for the duration of the
async, but we could still segfault when unreffing it, if the
pickable was a drawable, and its parent image had already died.

Furthermore, let the async work on a copy of the pickable's buffer,
rather than the pickable's buffer directly.  This avoids some race
conditions when the pickable is the image (i.e., when "sample
merged" is active), since then we're using image projection's
buffer, which is generally unsafe to use in different threads
concurrently.

Also, s/! has_alpha/has_alpha/ when looking for transparent pixels,
and quit early, at least during this stage, if the async in
canceled.

(cherry picked from commit b4e12fbbbb)
2018-12-19 15:36:10 +01:00
Ell
3e5e0e2d37 app: in bucket-fill tool, cancel async on tool destruction
When computing line-art, don't ref the bucket-fill tool in the
async data, and rather cancel any ongoing async upon tool
destruction, so that the async callback doesn't attept to touch the
now-dead tool.  This avoids segfaulting in the async callback when
switching to a different tool, while a line-art async operation is
active.

Additionally, always cancel any previous async operation in
gimp_bucket_fill_compute_line_art(), even if not starting a new
one.

(cherry picked from commit 663a6c7011)
2018-12-19 15:35:43 +01:00
Ell
1778943152 app: in bucket-fill tool, fix potential leak when computing line-art
In the line-art async function, pass ownership over the resulting
buffer to the async object, so that the buffer is properly freed in
case the async in canceled after line-art computation is complete,
but before the completion callback is called.

Also, clear the tool's async pointer in the completion callback, to
avoid leaking the last issued async.

(cherry picked from commit 2e45c4c8c8)
2018-12-19 15:34:38 +01:00
Ell
e996020e19 app: in the bucket-fill tool, avoid CRITICALs when computing line-art ...
... when the current image/drawable are NULL.

(cherry picked from commit 4575949cdf)
2018-12-19 15:34:24 +01:00
Jehan
a83bbf8249 app: end point detection uses both the end point rate and clamped value.
(cherry picked from commit 79571231c5)
2018-12-19 15:34:01 +01:00
Jehan
4c3fcdb6bb app: better handle drawable and image update for line art computation.
The "update" signal on drawable or projection can actually be emitted
many times for a single painting event. Just add new signals ("painted"
on GimpDrawable and "rendered" on GimpProjection) which are emitted once
for a single update (from user point of view), at the end, after actual
rendering is done (i.e. after the various "update" signals).

Also better support the sample merge vs current drawable paths for
bucket fill.

(cherry picked from commit 047265333c)
2018-12-19 15:33:40 +01:00
Jehan
6155889315 app: remove now useless erosion size option.
Since commit b00037b850, erosion size is not used anymore, as this step
has been removed, and the end point detection now uses local thickness
of strokes instead.

(cherry picked from commit 3f58a38574)
2018-12-19 15:33:28 +01:00
Jehan
c1c544f882 app: improve end point detection for smart colorization.
Previous algorithm was relying on strokes of small radius to detect
points of interest. In order to work with various sizes of strokes, we
were computing an approximate median stroke thickness, then using this
median value to erode the binary line art.

Unfortunately this was not working that well for very fat strokes, and
also it was potentially opening holes in the line art. These holes were
usually filled back later during the spline and segment creations. Yet
it could not be totally assured, and we had some experience where color
filling would leak out of line art zones without any holes from the
start (which is the opposite of where this new feature is supposed to
go)!

This updated code computes instead some radius estimate for every border
point of strokes, and the detection of end points uses this information
of local thickness. Using local approximation is obviously much more
accurate than a single thickness approximation for the whole drawing,
while not making the processing slower (in particular since we got rid
of the quite expensive erosion step).
This fixes the aforementionned issues (i.e. work better with fat strokes
and do not create invisible holes in closed lines), and also is not
subject to the problem of mistakenly increasing median radius when you
color fill in sample merge mode (i.e. using also the color data in the
input)!
Also it is algorithmically less intensive, which is obviously very good.

This new version of the algorithm is a reimplementation in GIMP of new
code by Sébastien Fourey and David Tschumperlé, as a result of our many
discussions and tests with the previous algorithm.

Note that we had various tests, experiments and propositions to try and
improve these issues. Skeletonization was evoked, but would have been
most likely much slower. Simpler erosion based solely on local radius
was also a possibility but it may have created too much noise (skeleton
barbs), with high curvature, hence may have created too many new
artificial endpoints.
This new version also creates more endpoints though (and does not seem
to lose any previously detected endpoints), which may be a bit annoying
yet acceptable with the new bucket fill stroking interaction. In any
case, on simple examples, it seems to do the job quite well.

(cherry picked from commit b00037b850)
2018-12-19 15:32:58 +01:00
Jehan
ee582784b7 app: force the image flush after a selection fill.
Other bucket fills are now done as filter until committed, but basic
selection fill is still done automatically. So let's make sure the
canvas is updated immediately (as it used to be before my changes).

(cherry picked from commit 287d90ba9e)
2018-12-19 15:32:13 +01:00
Jehan
8fb83d7751 app: fix uninitialized variables.
(cherry picked from commit 255f2e1cdf)
2018-12-19 15:31:30 +01:00
Jehan
fd0f5c50a5 app: recompute line art if needed after a bucket fill commit.
(cherry picked from commit 969143c436)
2018-12-19 15:30:26 +01:00
Jehan
b6227b2787 app: update gimp-2-10 for bucket fill changes for smart colorization.
Some differences in PDB between gimp-2-10 and master branches.
2018-12-19 15:28:54 +01:00
Jehan
6b1d7969ed app: edit the bucket fill tool options with new line art options.
I have not added all the options for this new tool yet, but this sets
the base. I also added a bit of TODO for several places where we need to
make it settable, in particular the fuzzy select tool, but also simply
PDB calls (this will need to be a PDB context settings.

Maybe also I will want to make some LineArtOptions struct in order not
to have infinite list of parameters to functions. And at some point, it
may also be worth splitting a bit process with other type of
selection/fill (since they barely share any settings anyway).

Finally I take the opportunity to document a little more the parameters
to gimp_lineart_close(), which can still be improved later (I should
have documented these straight away when I re-implemented this all from
G'Mic code, as I am a bit fuzzy on some details now and will need to
re-understand code).

(cherry picked from commit 824af12438)
2018-12-19 15:26:42 +01:00
Jehan
808cdc9880 app: bucket fill tool with a "paint-style" interaction.
Rather than just having a click interaction, let's allow to "paint" with
the bucket fill. This is very useful for the new "line art" colorization
since it tends to over-segment the drawing. Therefore being able to
stroke through the canvas (rather than click, up, move, click, etc.)
makes the process much simpler. This is also faster since we don't have
to recompute the line art while a filling is in-progress.
Note that this new behavior is not only for the line art mode, but also
any other fill criterion, for which it can also be useful.

Last change of behavior as a side effect: it is possible to cancel the
tool changes the usual GIMP way (for instance by right clicking when
releasing the mouse button).

(cherry picked from commit e1c4050617)
2018-12-19 15:26:42 +01:00
Jehan
0e1d8ef695 app: make line art pre-computation in threads.
This makes the speed sensation of the tool much faster as line art can
be computed in dead time when you start the tool or when you move the
pointer.

(cherry picked from commit a3cda4abbe)
2018-12-19 15:26:41 +01:00
Jehan
32f0a49ecc app: compute line art in advance.
Right now, this is mostly meaningless as it is still done sequentially.
But I am mostly preparing the field to pre-compute the line art as
background thread.

(cherry picked from commit f246f40494)
2018-12-19 15:26:38 +01:00
Jehan
0cf524e351 app: fix line art labellization.
The older labelling based off CImg code was broken (probably because of
me, from my port). Anyway I realized what it was trying to do was too
generic, which is why we had to fix the result later (labeling all
non-stroke pixels as 0, etc.). Instead I just implemented a simpler
labelling and only look for stroke regions. It still over-label a bit
the painting but a lot less, and is much faster.

(cherry picked from commit 93a49951a0)
2018-12-19 15:20:19 +01:00
Jehan
4da35468bc app: better use GeglBufferIterator!
I don't actually need to loop through borders first. This is what the
abyss policy is for, and I can simply check the iterator position to
verify I am within buffer boundaries or not.
This simplifies the code a lot.

(cherry picked from commit c4ff81540d)
2018-12-19 15:20:19 +01:00
Jehan
8557cd8cfb app: directly update the mask buffer with gegl_node_blit_buffer().
No need to create a temporary buffer for this.

(cherry picked from commit f02993fb9c)
2018-12-19 15:20:18 +01:00
Jehan
8dc6bcafa3 app: create a simple priority map for line art selection flooding.
We actually don't need to compute distance map. I just make the simplest
priority map, with 1 any line art pixel and 0 any other pixel (in mask
or not), lowest priority being propagated first.
And let the flooding begin!

(cherry picked from commit 410c747509)
2018-12-19 15:20:18 +01:00
Jehan
687d058416 app: with recent gegl:watershed-transform, no need for intermediate...
... labels buffer.
We can watershed directly the mask buffer being correctly flagged.
This commit relies on merge request gegl!8 being accepted and merged.

(cherry picked from commit e905ea7ba2)
2018-12-19 15:20:18 +01:00
Jehan
3b0a312e7e app: use char array for temporary data (rather than a GEGL buffer).
Also use more GeglBufferIterator on input GEGL buffer.
Using a char array is much less expensive and accelerated the line
erosion a lot!
Moving to GeglBufferIterator is not finished, but I do in steps.

(cherry picked from commit 0c80f8a718)
2018-12-19 15:20:17 +01:00
Jehan
325398fcf9 app: use simpler allocated variables.
Allocating double-level arrays is just very inefficient.

(cherry picked from commit f975f15ec0)
2018-12-19 15:18:22 +01:00
Jehan
95bbb26252 app: make visited into single-level allocated array.
(cherry picked from commit f19181dcf8)
2018-12-19 15:18:21 +01:00
Jehan
71ec6a9849 app: fix stroke labels in gimp_lineart_estimate_stroke_width().
I must make sure that stroke pixels are labelled 0 and non-stroke other
than 0.

(cherry picked from commit 910d7934f5)
2018-12-19 15:18:21 +01:00
Jehan
b1a3792aae app: use more GeglBufferIterator.
In this case, it makes the code a bit more messy, but hopefully more
efficient.

(cherry picked from commit 1822ea399a)
2018-12-19 15:18:21 +01:00
Jehan
6dbd12a915 app: use GeglBufferIterator rather than gegl_buffer_sample|set().
(cherry picked from commit 041a8f1eec)
2018-12-19 15:18:20 +01:00
Jehan
13466ba7e7 app: babl types returned by choose_format() must be float!
(cherry picked from commit fcd038eb16)
2018-12-19 15:18:20 +01:00
Jehan
239be8ecc8 app: implement second step for line art selection/filling.
When filling colors in line arts, you don't want to leave space between
the strokes and the color, which usually happen with any of the current
selection methods.
A "KISS" trick is usually to grow your selection a few pixels before
filling (adding an additional step in colorization process), which
obviously does not handle all cases (depending on drawing style and
stroke size, you may need to grow more or less) as it doesn't take into
account actual stroke geometry.

Instead, I label the selection and the "rest" differently and leave the
pixel strokes unlabelled. Then I let these unlabelled pixels be flooded
by the "gegl:watershed-transform" operation.
Note that this second step is different from the second step from the
GREYC research paper, as they use their own watershed algorithm taking
color spots as sources to color the whole image at once. This is a
different workflow from the one using bucket fill with a single color
source.

(cherry picked from commit 8502b4e743)
2018-12-19 15:18:20 +01:00
Jehan
bde56bdfdc app, libgimpbase: add GIMP_SELECT_CRITERION_LINE_ART selection type.
This commit implements part of the research paper "A Fast and Efficient
Semi-guided Algorithm for Flat Coloring Line-arts" from the GREYC (the
people from G'Mic). It is meant to select regions from drawn sketchs in
a "smart" way, in particular it tries to close non-perfectly closed
regions, which is a common headache for digital painters and colorists.

The implementation is not finished as it needs some watersheding as well
so that the selected area does not leave "holes" near stroke borders.
The research paper proposes a new watersheding algorithm, but I may not
have to implement it, as it is more focused on automatic colorization
with prepared spots (instead of bucket fill-type interaction).

This will be used in particular with the fuzzy select and bucket fill
tools.

Note that this first version is a bit slow once we get to big images,
but I hope to be able to optimize this.
Also no options from the algorithm are made available in the GUI yet.

(cherry picked from commit 8ed12b1b98)
2018-12-19 15:18:19 +01:00
Jehan
9a6aa31681 app: show the layer mode dropdown list properly.
Showing it was only displaying the top modes, with a lot of top space,
and you had to slowly scroll down the list. This is the same as #2642
(as Alexandre noted in a comment), so I just use the same "fix" though I
don't fully understand it. It feels more of a side effect of
gtk_combo_box_set_wrap_width() working around a bug of GtkComboBox. So
if anyone has a better fix and understand the issue, feel free to patch
(maybe GTK+ directly?). In the meantime, it works well enough. :-)

(cherry picked from commit 6dfca83c2a)
2018-12-19 15:14:23 +01:00
Kevin Stoffler
e17daf66e2 app: add gtk_combo_box_set_wrap_width for scale menu
(cherry picked from commit a9a979b2d0)
2018-12-19 13:46:34 +01:00
Ell
4e54ac9cdd app: update definition of "{cache,swap}-compressed" dashboard vars
Update the definition of the "cache-compressed" and "swap-
compressed" dashboard variables, to reflect the changes made by
GEGL commit gegl@dc22e997757ab91c180244d5290d094d2ea8572f.

(cherry picked from commit fda53f9c18)
2018-12-17 06:40:03 -05:00
Ell
fd297f943b app: in the warp tool, blink behavior combo when the current behavior is invalid
In the warp tool, when the warp is empty and the current behavior
has no effect as a result (i.e., when it's ERASE or SMOOTH), show
an error message in the status bar, and blink the behavior combo
widget in the tool options, to hint at the source of the error.

(cherry picked from commit 7958387d54)
2018-12-12 11:23:49 -05:00
Ell
6f4e233cf0 app: in the warp tool, blink stroke frame when no events are selected
In the warp tool, when no stroke events are selected, blink the
stroke frame widget in the tool options, in addition to showing an
error message in the status bar, to hint at the source of the
error.

(cherry picked from commit 17cc44a7be)
2018-12-12 11:23:48 -05:00
Ell
a8ef7db616 app: s/GEGL_WARP_BEHAVIOR/GIMP_WARP_BEHAVIOR/
The enumerators of the GimpWarpBehavior enum, except for MOVE, had
a GEGL_ prefix, rather than a GIMP_ prefix, for some reason.

Change all of them to GIMP_.

(cherry picked from commit 2085cb4a37)
2018-12-12 11:23:48 -05:00
Ell
df475195d4 app: in gimp_widget_blink_cancel(), avoid redrawing non-blinking widget
Since commit fe139e5662, when
blinking a widget, we cancel blinking for all its ancestors.  Avoid
redrawing all the ancestors as a result, unless they're actually
blinking.  This prevents some noticeable lag when blinking a
widget.

(cherry picked from commit 5a2dee29d7)
2018-12-10 14:19:40 -05:00
Ell
a8841a3c07 app: in all tools, blink lock box when the current item is locked
In all tools, when the current item can't be edited due to its lock
mask, use gimp_tools_blink_lock_box(), added in the previous
commit,to blink the lock box of the corresponding dockable, in
addition to showing an error message in the status bar, to hint at
the source of the error.

(cherry picked from commit 637105b962)
2018-12-10 08:57:14 -05:00
Ell
c237ee3c23 app: add gimp_tools_blink_lock_box()
Add gimp_tools_blink_lock_box() utility function, in a new
gimptools-utils.c file, which takes a GimpItem, and blinks the
GimpItemTreeView lock-box of the corresponding dockable.  This can
be used to hint that the item's lock toggles are preventing it from
being edited.

(cherry picked from commit 9bdaec3a49)
2018-12-10 08:57:11 -05:00
Ell
66a9dffa2e app: in gimp_widget_blink(), cancel blinking of parent widgets
When blinking a widget using gimp_widget_blink(), cancel the
blinking of all its ancestors, to reduce visual clutter.

(cherry picked from commit fe139e5662)
2018-12-10 08:55:43 -05:00
Ell
ace9b12205 app: in the paint tools, blink mode box when the current mode is invalid
In the paint tools, when the current paint mode is invalid, i.e.,
when it requires an alpha channel, but the the current drawable has
no alpha channel, or its alpha channel is locked, blink the paint-
mode box widget in the tool options, in addition to showing an
error message in the status bar, to hint at the source of the
error.

(cherry picked from commit 464bf1b0a9)
2018-12-10 08:55:43 -05:00
Ell
a42f2cb2e7 app: in the transform tools, blink type box when there's no item to transform
In the transform tools, when there is no item of the selected type
to transform, blink the move-type box widget in the tool options,
in addition to showing an error message in the status bar, to hint
at the source of the error.

(cherry picked from commit 17412aa234)
2018-12-10 08:55:42 -05:00
Ell
92c6f87391 app: in the move tool, blink type box when there's no item to move
In the move tool, when there is no item of the selected type to
move, blink the move-type box widget in the tool options, in
addition to showing an error message in the status bar, to hint at
the source of the error.

(cherry picked from commit c9bc3d7a09)
2018-12-10 08:55:41 -05:00
Ell
02ccab9e7e app: in the selection tools, blink mode box when the current operation is invalid
In the selection tools, when the selected operation is invalid,
i.e., when trying to subtract-from or intersect-with an empty
selection, blink the selection-mode box widget in the tool options,
in addition to showing an error message in the status bar, to hint
at the source of the error.

(cherry picked from commit f990e41609)
2018-12-10 08:55:41 -05:00
Michael Natterer
95deaa7bf3 app: clean up size group code in the preferences dialog
(cherry picked from commit 0efa00932b)
2018-12-10 12:18:51 +01:00
Richard McLean
acc15e614a Issue #1299 - Add selection of default export file type
Patch cleaned up by Alexandre Prokoudine and Michael Natterer.

(cherry picked from commit bfbad0a5ca)
2018-12-10 12:17:00 +01:00
Ell
a2c20b1539 Issue #2635 - Segfault when using measuring tool
In gimp_tool_compass_update_angle(), use fuzzy comparisson when
determining whether to update the angle properties, to avoid
infinite recursion due to floating-point inaccuracies.  In
partcicular, on x86, when using the x87 FPU rather than SSE, the
floating-point registers are 80-bit, while the properties are
stored as 64-bit, which can create small discrepancies between the
calculated angles and the stored values.

(cherry picked from commit ad831dbc6d)
2018-12-08 06:03:54 -05:00
Jehan
96d67fd1b2 Issue #2495: many tablets broken by GIMP 2.10.8.
We had many reports of tablets from various brands (Huion, Gaomon,
XP-Pen…) broken in the last release (though working fine when
downgrading to 2.10.6). Latest Huion drivers seem to fix the issue
(according to at least one report), but this is not the case for other
tablets.

Though unable to test myself, provided stderr logs indicate that we hit
the case when 2 devices with the same name are registered. Therefore
this commit is basically reverting commit 717c183a3e (though keeping and
completing the comments). I don't think there is an ultimate solution
here but with this regression, experience shows us there seem to be a
lot more breakage when overwriting the device with newer occurences (at
least on Windows). It is unclear though if commit 717c183a3e was also
supposed to fix another case actually encountered. If so, we will need
to get an even more advanced solution.

(cherry picked from commit ce24e16083)
2018-12-07 00:51:13 +01:00
Jehan
48e14ef3b9 app, libgimpconfig: make various usage of g_file_replace() safer.
When an error occurs, we want to prevent overwriting any previous
version of the file by incomplete contents. So run
g_output_stream_close() with a cancelled GCancellable to do so.
See also discussion in #2565.

(cherry picked from commit 613bf7c5ab)
2018-12-07 00:51:05 +01:00
Jehan
c9da44bed3 app: do no overwite XCF when an error occurred at saving time.
We can cancel a file overwrite at the last second when closing the
stream by setting a cancelled cancellable. Current code was simply not
closing the stream, but this was not enough as overwriting was happening
anyway (probably when finalizing).
This will allow much safe saving process since we would not be
overwriting a previously sane XCF file when an error occurred (either in
our code or a memory error, or whatnot).
See also discussion in #2565.

(cherry picked from commit 076b53511a)
2018-12-07 00:27:12 +01:00
Ell
61a181933c app: in GimpProjection, fix reinit. of current row when chunk height changes
In GimpProjection's chunk renderer, when the chunk height changes
in the middle of a row, we need to merge the remainder of the
current render area back into the renderer's update region, and
refetch the remainder of the row as the new render area, so that we
don't miss any unrendered area, or re-render already-rendered area,
due to the change in chunk height.  However, we should previously
fail to verify that the fetched area is, in fact, the remainder of
the current row, which could cause us to render the wrong area,
missing parts of the update region.

Fix this, by breaking up some of the chunk-renderer fucntions into
smaller sub-functions, and using those in order to explicitly set
the new render area to the remainder of the current row when the
chunk height changes.  This also avoids erroneously merging the
unflushed update region of the projection into the renderer's
update region.

(cherry picked from commit c9c2397b0d)
2018-12-06 08:51:04 -05:00
Ell
09863478db Revert "app: save images with fractional grid coordinates as version-10 XCFs"
Actually, image grids are saved as parasites, so even though older
GIMP versions round their coordinates upon loading, they maintain
the fractional coordinates when re-saving the image, hence bumping
the XCF version is not really necessary.

This reverts commit 13119efda33a7aba323dc13e6a56207a15a9f000.

(cherry picked from commit 411ddb7e48)
2018-12-05 13:52:56 -05:00
Ell
6ca294abe0 app: save images with fractional grid coordinates as version-10 XCFs
Fractional-coordinate support for image grids was added in commit
1572bccc9f, right before the
introduction of XCF version 10.  While images with fractional grid
coordinates can be loaded with earilier versions of GIMP, the grid
coordinates are rounded to the nearest integer.

Bump the minimal XCF version when saving images with fractional
grid coordinates to 10, which should have been the case all along.

(cherry picked from commit a90322278d)
2018-12-05 13:33:42 -05:00
Ell
b06ffe4334 Issue #2604 - XCF saving bug in xcf_save_buffer()
The NULL terminator of the tile-offset array of dummy buffer-levels
is erroneously written as an int32, instead of an offset, even in
version-11+ XCFs, in which offsets are 64-bit.

Since the dummy levels aren't actually used by GIMP, we're going to
keep these fields as int32 as an exception, in order to remain
consistent with existing XCFs, and just add a comment in the code,
and update the docs.  If we ever make use of the higher buffer
levels, we should change these fields to offsets, and bump the XCF
version.

(cherry picked from commit 2168d91cf7)
2018-12-04 12:09:55 -05:00
Ell
fa74fe78f9 app: don't use direct-buffer fill when some components are masked
(cherry picked from commit 83250eb57c)
2018-12-03 09:54:18 -05:00
Ell
03a4fafe30 app: mark REPLACE and PASS_THROUGH modes as trivial
(cherry picked from commit f508ec8b89)
2018-12-03 09:54:18 -05:00
Ell
5b857dbb4b libgimpcolor, app, modules, plug-ins: remove GEGL_ITERATOR2 define
... it's no longer needed, since GEGL commit
gegl@9dcd2cde63f95a080bf16a58c10e9ffbdd99aace.

Partially reverts commits:

6fca9959c7
cc10af72cc
49c53568d7
8edbc0d491
29f63616d2
3a2014984d
ee48ec6877
4165a315d5
764085278f
b7633c722e
6ab12061b7
754a3c5b18
22b4b647bd
55b3438328
c6d23add65
f03a84d607
822f9f0d2b
95358ca1fa
cdda37f4ee
41e8035635
6761da42b2
fb5d7832a8
97ed7817d8
46e9036578
ea9c5e6a49
24fbdfb591
beb4ecb238
4b77831e03
fcf113a39c
567ffe94ff

(cherry picked from commit 053e5edc93)
2018-12-02 11:21:36 -05:00
Ell
edbda43028 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
efficiently.

Likewise, pass TRUE when benchmarking the projection through the
debug action, and avoid flushing the display, to more accurately
measure the render time.

(cherry picked from commit dac9bfe334)
2018-12-02 10:15:36 -05:00
Ell
33a015abef app: fix iterated-over area in gimp_gegl_clear()
Iterate over the per-thread area, not the full region.

(cherry picked from commit 06923d0f65)
2018-12-02 03:48:35 -05:00
Ell
98bf8319b6 app: another fix to drawable direct-fill criterion
Don't use a direct-buffer fill when filling using a pattern with
alpha, even when the mode is subtractive.

(cherry picked from commit 42b82419b1)
2018-12-02 03:43:28 -05:00
Ell
61b1e7a348 app: fix drawable direct-fill criterion
Don't use a direct-buffer fill if the mode is subtractive, and the
composite region includes the source.  Currently, this never
actually happens.

(cherry picked from commit 660f53d300)
2018-12-02 03:34:02 -05:00
Ell
8a131e97f1 app: optimize simple whole-drawable fill/clear
In gimp_drawable_edit_fill(), when filling/clearing the whole
drawable, without any special compositing (i.e., when there's no
selection, the opacity is 100%, and the layer mode is trivial),
fill/clear the drawable's buffer directly, without using an
applicator.  This makes such operations much faster, especially in
big images.

(cherry picked from commit dd8268c0a2)
2018-12-02 03:11:22 -05:00
Ell
5d536afded app: add gimp_fill_options_fill_buffer()
... which is similar to gimp_fill_options_create_buffer(), however,
it fills an existing buffer, instead of creating a new buffer.

Implement gimp_fill_options_create_buffer() in terms of the new
function.

(cherry picked from commit 45fc4cb4f9)
2018-12-02 03:11:21 -05:00
Ell
2dda622a20 app: add gimp_layer_mode_is_trivial()
Add a TRIVIAL layer-mode flag, and corresponding
gimp_layer_mode_is_trivial() function, which indicates if the blend
function of a given layer mode is trivial, i.e., either never
modifies the source pixels (for non-subtractive modes), or always
clears the destination pixels (for subtractive modes).

(cherry picked from commit 8adec5fb3a)
2018-12-02 03:11:21 -05:00
Ell
c4e51b9a45 app: add gimp_gegl_clear()
... which clears the alpha component of a given buffer region,
i.e., it makes the region transparent, while preserving color
information.  This corresponds to the "edit-clear" action.

(cherry picked from commit 2e3eab7fbd)
2018-12-02 03:11:20 -05:00
Ell
f7f4543416 app: in GimpPaintCore, align copied undo rect to tile grid
In gimp_paint_core_finish(), when copying the relevant region of
the cached undo buffer into a new buffer, align the region to the
buffer's tile grid, so that all copied tiles are COWed.  This
avoids lag when finishing a stroke.

(cherry picked from commit 861f356b63)
2018-12-02 03:11:20 -05:00
Ell
782d54a615 app: align drawable undo rectangle to tile grid
When creating a drawable undo from the drawable's buffer, align the
copied rectangle to the buffer's tile grid, so that all the copied
tiles are COWed, saving memory and gaining speed.

Add applied_x and applied_y fields to GimpDrawableUndo, specifying
the position at which to apply the applied_buffer, so that we apply
it in the right place, even if the undo rect has changed due to
alignment.

(cherry picked from commit bb9dd049fb)
2018-12-02 03:11:19 -05:00
Ell
6e82635d4f app: use gimp_gegl_rectangle_align_to_tile_grid() in gimp:buffer-source-validate
... instead of custom code.

(cherry picked from commit ce3a6c4fd6)
2018-12-02 03:11:18 -05:00
Ell
2b14355689 app: add gimp_gegl_rectangle_align_to_tile_grid()
... which expands a GeglRectangle, such that it's aligned to the
tile grid of a given GeglBuffer.

(cherry picked from commit 69e5f783c5)
2018-12-02 03:11:16 -05:00
Ell
0568490929 app: a few improvements to gimp-scratch
Simplify code a bit, and add branch-prediction annotations.

(cherry picked from commit f27b38808f)
2018-12-01 10:04:22 -05:00
Ell
a30087e83e app: sigh, another gimp-scratch link fix, in config/
That's the last one :)

(cherry picked from commit 67d595f651)
2018-12-01 08:27:44 -05:00
Ell
1a6281961e app: fix gimp-scratch linking in tests/ 2018-12-01 07:22:07 -05:00
Ell
5b5027dee1 app: fix gimp-scratch linking
(cherry picked from commit ae6bebb981)
2018-12-01 06:23:40 -05:00
Ell
806db2e64c app: #include <string.h> in gimp-scratch.h
... for memset().

(cherry picked from commit 8c9eb1c743)
2018-12-01 06:06:30 -05:00
Ell
59a3b9e5c0 app: fix definition signature of gimp_scratch_get_total()
(cherry picked from commit 5d1a79a34f)
2018-12-01 05:58:14 -05:00
Ell
595218f1d4 app: in Luminance mode, cache RGBA -> Y fish
(cherry picked from commit dbab0b557d)
2018-12-01 05:55:25 -05:00
Ell
963f036a4a app: in Luminance mode, replace VLAs with gimp-scratch
In the Luminance layer-mode, use the scratch allocator for
allocating temporary buffers, instead of using VLAs.
GimpOperationLayerMode already allocates data on the stack,
calculated as not to overflow the stack on any platform, so having
any of its descendants also allocate big buffers on the stack is
risky.

(cherry picked from commit 70b7316ebc)
2018-12-01 05:55:24 -05:00
Ell
c3ce696ce0 app: add scratch-total variable to the dashboard
Add a scratch-total variable to the dashboard's misc group, showing
the total amount of memory used by the scratch allocator.

(cherry picked from commit 698d1af798)
2018-12-01 05:55:24 -05:00
Ell
8593eb88fd app: add gimp-scratch allocator
gimp-scratch is a fast memory allocator (on the order of magnitude
of alloca()), suitable for small (up to a few megabytes), short-
lived (usually, bound to the current stack-frame) allocations.
Unlike alloca(), gimp-scratch doesn't use the stack, and is
therefore safer, and will also serve bigger requests, by falling-
back to malloc().

The allocator itself is very simple:  We keep a per-thread stack of
cached memory blocks (allocated using the normal allocator).  When
serving an allocation request, we simply pop the top block off the
stack, and return it. If the block is too small, we replace it with
a big-enough block.  When the block is freed, we push it back to
the top of the stack (note that even though each thread uses a
separate stack, blocks can be migrated between threads, i.e.,
allocated on one thread, and freed on another thread, although this
is not really an intended usage pattern.)  The idea is that the
stacks will ultimately stabalize to contain blocks that can serve
all the encountered allocation patterns, without needing to reisze
any of the blocks; as a consequence, the amount of scratch memory
allocated at any given time should really be kept to a minimum.

(cherry picked from commit a8a8655285)
2018-12-01 05:55:23 -05:00
Ell
d86d017980 app: in GimpBacktrace Linux backend, don't leak backtrace when dropping threads
Should have been part of commit
a29d040db5.

(cherry picked from commit 01f9409902)
2018-12-01 04:33:48 -05:00
Ell
31acea2cf7 app: in GimpBacktrace Linux backend, make blacklisted_thread_names const
(cherry picked from commit c749097dcc)
2018-12-01 03:52:36 -05:00
Ell
b493cb51f4 app: use gimp_async_add_callback_for_object() in various places
Use gimp_async_add_callback_for_object(), added in the previous
commit, instead of gimp_async_add_callback(), in cases where the
destructor of the object owning the async doesn't wait for the
async to finish.  This avoids leaking such ongoing asyncs on
shutdown, during which gimp-parallel either finishes or aborts the
asyncs: if at this point an async has any registered callbacks, an
idle source is added for running the callbacks, extending the
lifetime of the async; however, since we're not getting back into
the main loop, the idle is never run, and the async (and any
associated resources) are never freed.

(cherry picked from commit 7c00cf498a)
2018-11-30 04:15:45 -05:00
Ell
34cb63a048 app: add gimp_async_add_callback_for_object()
... which is similar to gimp_async_add_callback(), taking an
additional GObject argument.  The object is kept alive for the
duration of the callback, and the callback is automatically removed
when the object is destroyed (if it hasn't been already called).

This is analogous to g_signal_connect_object(), compared to
g_signal_connect().

(cherry picked from commit 49fd2847ac)
2018-11-30 04:15:44 -05:00
Ell
9001d65804 app: unref async when removing last callback if idle is pending
In gimp_async_remove_callback(), if removing the last callback
while the callback idle-source is already pending, cancel the idle
source and unref the async object (the async is reffed when adding
the idle source.)

(cherry picked from commit a779dd3849)
2018-11-30 04:15:44 -05:00
Ell
b0b541d670 app: use gimp_tile_handler_validate_validate() in gimp:buffer-source-validate
Use gimp_tile_handler_validate_validate(), added in the commit
before last, in gimp:buffer-source-validate, in order to pre-render
the necessary region of the buffer, instead of performing the
validation implicitly by iterating over the region.  This is both
simpler, and, more importantly, allows us to render the entire
region in a single chunk, instead of tile-by-tile, which can be
considerably more efficient, especially with high thread counts.

This essentially extends the dynamic sizing of rendered projection
chunks to layer groups, which are rendered through
gimp:buffer-source-validate, rather than just the main image
projection.

(cherry picked from commit 83dd94ba6a)
2018-11-28 13:27:01 -05:00
Ell
378dc07c7b app: use gimp_tile_handler_validate_validate() in GimpProjection
Use gimp_tile_handler_validate_validate(), added in the last
commit, in GimpProjection, in order to render the projection,
instead of separately invalidating the buffer, undoing the
invalidation, and then rendering the graph.  This is more
efficient, and more idiomatic.

(cherry picked from commit d6f0ca5531)
2018-11-28 13:27:00 -05:00
Ell
a4fb3e11d6 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.

(cherry picked from commit 82a60997d4)
2018-11-28 13:27:00 -05:00
Ell
50b3c2b8ba 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().

(cherry picked from commit 0ad41cfe0c)
2018-11-28 13:26:59 -05:00
Ell
cc81f66f12 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().

(cherry picked from commit 5a623fc54b)
2018-11-28 13:26:58 -05:00
Ell
18815512f2 app: avoid starting the chunk renderer while finishing drawing a projection
In gimp_projection_finish_draw(), make sure we don't accidentally
re-start the chunk renderer idle source while running the remaining
iterations, in case the chunk height changes, and we need to reinit
the renderer state.

(cherry picked from commit 8a47b68194)
2018-11-28 13:26:58 -05:00
Ell
6ab3ecaca2 app: avoid flushing bufferless projections
Don't needlessly flush projections whose buffer hasn't been
allocated yet.  This can happen when opening an image, in which
case the image is flushed before its projection has a buffer.

(cherry picked from commit b07f810273)
2018-11-28 13:26:57 -05:00
Ell
90292953c3 app: in gimp-parallel, boost priority of waited-upon asyncs
When an async that was created through
gimp_parallel_run_async[_full](), and whose execution is still
pending, is being waited-upon, maximize its priority so that it
gets executed before all other pending asyncs.

Note that we deliberately don't simply execute the async in the
calling thread in this case, to allow timed-waits to fail (which is
especially important for gimp_wait()).

(cherry picked from commit 62baffed98)
2018-11-24 11:07:13 -05:00
Ell
8222124a96 app: add GimpAsync::waiting signal
... which is emitted when the async is being waited-upon, blocking
execution.

(cherry picked from commit 965da12b35)
2018-11-24 11:07:12 -05:00
Ell
79a44eda6d app: more gimp-parallel fixes
Fix indentation in gimp-parallel.{cc,h}.

Remove unused typedefs in gimp-parallel.h.

s/Gimp/Gegl/ in function-type cast in gimphistogram.c.

(cherry picked from commit 05a4437d9a)
2018-11-24 11:05:10 -05:00
Ell
8fe6645950 app: indentation fix in gimp-parallel.cc
(cherry picked from commit 115fc174f2)
2018-11-24 11:05:10 -05:00
Ell
d4312fd5f7 app: remove gimp_parallel_distribute(); use gegl_parallel_distribute()
The parallel_distribute() family of functions has been migrated to
GEGL.  Remove the gimp_parallel_distribute() functions from
gimp-parallel, and replace all uses of these functions with the
corresponding gegl_parallel_distrubte() functions.

(cherry picked from commit 2736cee577)
2018-11-24 11:05:10 -05:00
Ell
ac4ded137f configure.ac: require GEGL >= 0.4.13
(cherry picked from commit 43e3939d4a)
2018-11-24 11:05:10 -05:00
Oleksii Samorukov
63e86da6f3 tests: OSX - activate GIMP window when tests are running
If window is not focused gimp_test_utils_synthesize_key_event would
fail.
2018-11-23 23:15:25 +01:00
Oleksii Samorukov
9ae19eb8ec tests: implement gimp_test_utils_synthesize_key_event on OSX/QUARTZ 2018-11-23 23:06:12 +01:00
Ell
4b647c52e1 Issue #2553 - Can't Move Imported or Pasted Path
Initialize the X/Y tilt fields of improted/pasted path control
points to 0, instead of 0.5, which is the normal value for these
fields in paths.  This avoids calculating bogus distances when
trying to pick the path, causing picking to fail.

(cherry picked from commit 0a123a81a3)
2018-11-23 08:48:41 -05:00
Alex Samorukov
62c52742cd do not activate OSX menu if tests are running to prevent crash 2018-11-23 11:39:21 +01:00
Alex Samorukov
d650e9f81f add to fix test link on OSX 2018-11-23 10:45:39 +01:00
Alex Samorukov
465b4b10fb Enable hires retina support for the GTK2/OSX build 2018-11-22 13:45:30 +00:00
Ell
0a39f362b5 libgimpbase, libgimp, app: pass misc. GEGL config to plug-ins
Pass the GEGL tile-cache size, swap path, and thread-count to plug-
ins as part of their config, and have libgimp set the plug-in's
GeglConfig accordingly upon initialization.
2018-11-19 17:09:59 -05:00
Michael Natterer
ab48f12fd6 Issue #2224 - Use the "Swap folder" setting for the GEGL cache
Move swap/cache and temporary files out the GIMP user config dir:

libgimpbase: add gimp_cache_directory() and gimp_temp_directory()
which return the new default values inside XDG_CACHE_HOME and the
system temp directory. Like all directories from gimpenv.[ch] the
values can be overridden by environment variables. Improve API docs
for all functions returning directories.

Add new config file substitutions ${gimp_cache_dir} and
${gimp_temp_dir}.

Document all the new stuff in the gimp and gimprc manpages.

app: default "swap-path" and "temp-path" to the new config file
substitutions. On startup and config changes, make sure that the swap
and temp directories actually exist.

In the preferences dialog, add reset buttons to all file path pages.

(cherry picked from commit a29f73bd9a)
2018-11-18 18:27:05 +01:00
Ell
6f61a7d431 configure.ac: require babl >= 0.1.60
(cherry picked from commit 3821ce4bcd)
2018-11-15 12:56:13 -05:00
Ell
5b93eee52a app: in scale tool, scale around center even when using numeric input
In the scale tool, when the "around center" option is toggled,
scale the item around its center not only through canvas
interaction, but also when entering width/height values through the
tool GUI.

(cherry picked from commit 786bfa5171)
2018-11-15 12:53:11 -05:00
ONO Yoshio
cd55cb3102 Issue #2489 - Gimp 2.10.8 layer menu text along path
Related #2064 - text along path not working with vertical text.

(cherry picked from commit a2da1cd596)
2018-11-13 12:56:25 +09:00
Ell
7ca3fe6576 Issue #2473 - Transforming a layer doesn't properly transform its mask
In gimp_drawable_transform_buffer_affine(), avoid modifying the
clipping mode when transforming layer masks, since this function is
used (among other things) to transform layer masks together with
their layer, in which case they should use the same clipping mode
as the layer.

This fixes a regression introduced by commit
2ae823ba2b, causing layer masks to be
transformed with a mismatched clipping mode during layer
transforms, leading to discrepencies between the transformed layer
and the transformed mask.

This commit merely reverts the necessary part of above commit,
fixing the regression, though note that this code is really up for
some serious refactoring: the logic for determining which clipping
mode to use when is spread all over the place.

(cherry picked from commit 45fc30caa7)
2018-11-11 02:28:25 -05:00
Ell
dd52d8d7a5 app: in performance logs, add new-lines between variable definitions
(cherry picked from commit c7f1730702)
2018-11-10 02:52:51 -05:00
Ell
fafeb7bf07 app: a few improvements to the GimpBacktrace Linux backend
Blacklist the "threaded-ml" thread, which seems to mask the
backtrace signal.

Improve signal-handler synchronozation, to avoid segfaulting when
giving up on waiting for all threads to handle the signal.
Furthermore, when one or more threads fail to handle the signal in
time, return a GimpBacktrace instance with backtraces for all the
other threads, and with empty backtraces for all the non-responding
threads, instead of returning NULL and leaking the allocated
instance.  Don't blacklist threads that failed to handle the signal
in time, and instead shorten the wait period for handling the
signal, and yield execution during waiting to lower the CPU usage.

(cherry picked from commit a29d040db5)
2018-11-07 14:26:40 -05:00
Ell
645e30e641 app: a few fixes to performance-log backtrace output
Fix delta-encoding of performance-log backtraces in certain cases,
and distinguish between empty call-stacks and removed threads.

(cherry picked from commit eec1e1f189)
2018-11-07 14:26:38 -05:00
Ell
ee3c6a9323 app: don't let image component mask affect channel colors
Connect GimpImage's gimp:mask-components node to the layers node
*before* connecting the channels node, so that the image's
component mask doesn't affect the channel colors, as is the case in
2.8.

(cherry picked from commit 56920dcdbf)
2018-11-04 13:24:05 -05:00
Ell
bc3847e851 app: avoid allocating empty tempbuf for drawable previews
In gimp_view_renderer_drawable_render(), make sure the preview size
is always at least 1x1.

Fixes commit 8009ea342a.

(cherry picked from commit 963322fdd4)
2018-11-03 04:30:23 -04:00
Ell
b8862acee9 app: include variable descriptions in performance logs
Include instrumentation-variable descriptions in the var-defs
section of performance logs, so that they can be displayed
alongside their names when viewing the log.

(cherry picked from commit 646208eff0)
2018-11-03 04:17:55 -04:00
Ell
5456226c99 app: simplify drawable preview rendering
Simplify gimp_view_renderer_drawable_render(), by consolidating
common code paths.  In particular, when rendering the preview as
part of an image, always crop the preview to the bounds of the
image, even when downscaling, to avoid unnecessarily downscaling/
convering cropped-out regions.  We previously only did this when
upscaling the preview by a factor of 2 or more; whatever the reason
for this used to be, it's no longer there.

(cherry picked from commit 8009ea342a)
2018-11-03 04:06:17 -04:00
Ell
4f27efc4a0 Issue #2436 - Crash after downsizing canvas
In gimp_view_renderer_drawable_render(), avoid overflow in preview-
area calculation.  This prevents erroneously setting 'scaling_up'
to FALSE while upscaling the drawable by a very large amount, which
can lead to the creation of a very large GimpTempBuf for the
preview, causing memory allocation to fail.

(cherry picked from commit 0cdbe91e5a)
2018-11-02 21:44:10 -04:00
Michael Natterer
a33a629bd9 Issue #2379 - Crash on saving
file_save(): make sure we always set an error on failure

file_save_dialog_save_image(): additionally, check that "error" exists
before dereferencing it.

(cherry picked from commit c55f2308e1)
2018-10-31 23:52:13 +01:00
Ell
13ee89d491 app: fix tests for new show-tabs option
In app/tests, add the show-tabs pref, added in commit
1ca2d74411, to the expected sessionrc
files.

(cherry picked from commit 4113aaad69)
2018-10-27 05:43:18 -04:00