Commit Graph

21992 Commits

Author SHA1 Message Date
Ell 1846764d3b app: include system gimp.css file in theme.css
Include the system-wide gimp.css file, in addition to the user-
specific gimp.css file, in the generated theme.css file, instead of
copying the former into the latter when creating the user's
gimpdir.  This allows us to modify the system-wide gimp.css file,
and having the changes take effect in existing installations.
2019-03-27 20:14:10 -04:00
Ell 846d242f30 app: revert combo-box drop-down changes
Revert the use of gtk_combo_box_set_wrap_width() to change the
combo-box drop-down style, except for the status-bar unit combo.
See https://gitlab.gnome.org/GNOME/gimp/issues/2828#note_421312 for
the rationale.

This reverts commits 1d984542e9,
68a33ab5bd, and
6dfca83c2a.
2019-03-27 20:14:10 -04:00
Ell 234f76b6fb app: use gimp:fill-source in gimp_drawable_edit_fill()
In gimp_drawable_edit_fill(), when performing a non-direct fill,
use a GimpDrawableFilter with gimp:fill-source, added in the
previous commit, instead of using gimp_drawable_apply_buffer() with
an intermediate fill buffer.  This avoids allocating a full-size
fill buffer, which may occupy a lot of space in pattern fills.
2019-03-27 15:45:59 -04:00
Ell 6b0337e384 app: add gimp:fill-source operation
Add a new gimp:fill-source operation, which can act as a source
node for fill operations, instead of a fill buffer.  The op takes
a GimpFillOptions object, a drawable, and a pattern offset, and
uses gimp_fill_options_create_buffer() to produce its output.

This allows performing the entire fill operation in chunks as a
graph, instead of allocating a full-size fill buffer, which can
can occupy a lot of space for pattern fills.
2019-03-27 15:45:59 -04:00
Ell 3c1634ee0d app: improve gimp_drawable_fill_buffer() for patterns
In gimp_drawable_fill_buffer(), when the fill-source is a pattern,
avoid going through an intermediate buffer when there's no profile
transform, and use the destination-buffer format for the
intermediate buffer, instead of the pattern format, when there is a
profile transform.
2019-03-27 15:45:58 -04:00
Ell 245a17c79f app: use compositing format for fill buffer
Add gimp_fill_options_get_format(), which returns the format to be
used for the fill buffer; this is the same format used during
compositing.  Use this format in gimp_fill_options_create_buffer(),
instead of the drawable format.

This fixes the result of fill operations when the fill color/
pattern is not representable in the drawable format, and speeds up
color fills by avoiding color-conversion for the fill buffer during
processing.
2019-03-27 15:45:58 -04:00
Ell b0dfc1e7c7 app: in GimpDrawableFilter, set underlying operation
In GimpDrawableFilter, use
gimp_gegl_node_set_underlying_operation() to the the input
operation node as the underlying operation of the filter node.
2019-03-27 15:45:57 -04:00
Ell 213b126c6e app: use underlying operation in gimp_gegl_apply_cached_operation()
In gimp_gegl_apply_cached_operation(), use the underlying
operation, as returned from
gimp_gegl_node_get_underlying_operation(), for testing whether the
operation is a point operation, for the purpose of avoiding
duplicating the input buffer.  Likewise, avoid duplicating the
buffer when the underlying operation is a source operation.
2019-03-27 15:45:57 -04:00
Ell eb5e473665 app: add gimp_gegl_node_{set,get}_underlying_oepration()
... which allow setting/getting the "underlying operation" node of
a graph node.  For example, GimpDrawableFilter constructs a complex
graph around a given operation node, which would be the underlying
operation of the graph.  This allows querying the properties of the
underlying operation, given only the graph.

In recursive cases, gimp_gegl_node_get_underlying_operation()
returns the most-nested underlying operation; when no underlying
operation has been set, gimp_gegl_node_get_underlying_operation()
returns the input node.
2019-03-27 15:45:55 -04:00
Ell ff13e55c16 app: add gimp_gegl_node_is_source_operation()
... which determines if a node is a source operation.
2019-03-27 15:45:31 -04:00
Ell 8f845d3a51 app: in gimp_drawable_apply_buffer(), work in chunks
In gimp_drawable_real_apply_buffer(), use GimpChunkIterator to blit
the applicator's output to the drawable's buffer in chunks, to
minimize the space used for intermediate results.
2019-03-27 15:45:30 -04:00
Ell e904b71242 app: improve responsiveness of GimpChunkIterator
In GimpChunkIterator, redajust the target area at each step,
instead of at each iteration, to adapt more quickly to the current
processing speed.  To avoid creating uneven chunks as a result,
only change the chunk height at the beginning of rows, unless the
resulting area would be more than twice as big as the target area.
2019-03-27 15:45:30 -04:00
Ell 9d80ccc3e6 app: preserve projection priority rect across structure/bounds changes
In GimpProjection, store the priority rect in image coordinates,
and only convert it to projectable coordinates when initializing
the chunk-iterator's priority rect.  This allows us to preserve the
priority rect across projectable structure/bounds changes.
2019-03-26 04:58:51 -04:00
Ell 30da2f3d6f app: don't disable filter format conversion if != drawable format
In gimp_drawable_merge_filter(), don't disable the filter
applicator's output-format conversion node if the output format is
different than the drawable's format, since it may change the
result.
2019-03-25 09:16:23 -04:00
Ell 733a6ec01c app: skip cache and format conversion when merging a drawable filter
In gimp_drawable_merge_filter(), disable the filter applicator's
cache and output-format conversion nodes before processing the
uncached region of the filter, so that the result is written
directly to the drawable's buffer.
2019-03-25 09:02:27 -04:00
Ell d4689441fe app: small fix to gimp_gegl_mask_combine_ellipse_rect() 2019-03-24 14:45:45 -04:00
Ell 106df3b794 Issue #3142 - Filters on-canvas preview doesn't work ...
... immediately after an image precision change

When flushing a projection, make sure it has a buffer, instead of
bailing if it doesn't.  We rely on the image projection's "update"
signal to update the display after certain operations that free the
buffer, which would previously fail to happen, and cause subsequent
flushes to be ignored until the buffer is explicitly accessed.

This fixes commit b07f810273.
2019-03-24 03:20:39 -04:00
Ell a712308f20 Issue #3134 - Deleting last layer of group not updating image
In gimp_group_layer_get_size(), make sure to always set *width and
*height, even when the group is empty, so that when the function is
called through gimp_projectable_get_size() by the group's
projection, the correct size is reported.  This makes sure we
update the correct area when the group becomes empty.
2019-03-20 17:48:47 -04:00
Ell 8e77347cac app: improve gimpchannel-{combine,select}
In gimpchannel-select, move some of the common functionality of the
various gimp_channel_select_foo() functions to gimpchannel-combine.
Furthermore, don't special-case CHANNEL_OP_INTERSECT, but rather
pass it over to gimpchannel-combine, which is now prepared to
handle it in all functions, as per the previous commits.

In gimpchannel-combine, factor out the common functionality of the
various gimp_channel_combine_foo() functions into a pair of
gimp_channel_combine_{start,end}() functions, which are called
before/after the actual gimp_gegl_mask_combine_foo() function,
respectively.  In particular, these functions deal with calculating
the new channel bounds.  Previously, the various
gimp_gegl_mask_combine_foo() functions would implicitly invalidate
the channel bounds (since commit
d0ae244fe8), rendering the bounds-
recalculation code ineffective.  This avoids manually recalculating
the bounds in many cases, speeding up selection operations.
2019-03-20 16:24:37 -04:00
Ell a227c8e94d app: improve gimp_gegl_mask_combine_buffer()
Simplify code, use gimp_gegl_buffer_copy() for CHANNEL_OP_REPLACE
when possible, improve value clipping, and parallelize processing.
2019-03-20 16:01:57 -04:00
Ell 1044342393 app: improve gimp_gegl_mask_combine_ellipse[_rect]()
Improve gimp_gegl_mask_combine_ellipse_rect() -- the funciton
responsible for rendering ellipse/rounded-rectangle selections.

Most notably, this commit significantly improves the function's
performance, by identifying whole tiles, whole rows, or parts of a
row, that are fully inside, or fully outside, the ellipse, and
filling them in bulk, instead of calculating the anti-aliasing
value at each pixel, which is now only done along the
circumference.

This commit also improves anti-aliasing, by more accurately
approximating the distance from a pixel to the ellipse, and by
normalizing the distance according to the pixel's cross-section
length in the direction of the said point.  In particular, we
guarantee that pixels that are fully inside/outside the ellipse
have a value of 1/0, respectively, facilitating the aforementioned
optimization.

Additionally, this commit fixes various edge cases where several
primitives coincide at a single pixel (in the rounded-rectangle
case), adds support for CHANNEL_OP_INTERSECT, and parallelizes
processing.
2019-03-20 15:58:29 -04:00
Ell 8a6e1c907d app: improve gimp_gegl_mask_combine_rect()
Simplify the code, and add support for CHANNEL_OP_INTERSECT.
2019-03-20 15:58:29 -04:00
Ell 5198d3c32d app: convert gimp-gegl-mask-combine to C++
... in preparation for next commits.
2019-03-20 15:58:28 -04:00
Ell ffaaa81c8a app: add gimp_babl_format_change_{component_type,trc}()
... which change a format's component-type/TRC, without otherwise
affecting it.
2019-03-20 15:57:05 -04:00
Ell d7f12c9d26 app: add gimp_babl_is_bounded()
... which takes a GimpPrecision, and determines if its values are
bounded to the [0,1] range (which is currently only true for
integer precisions).
2019-03-20 15:50:35 -04:00
Jehan 9042e85f3c app: make gimp_prop_gui_chain_toggled() less error-prone.
Don't assume that "toggled" signal means that toggle status actually
changed.

Though issue #3133 got fixed with my previous commit, let's make sure we
never create several GBinding for the same GimpChain by always checking
existence of a previous one after a "toggled" signal.
Also only create a GBinding object if one doesn't already exist.
2019-03-20 15:05:22 +01:00
Jehan 03dc24455a Issue #3133: Gimp freezes after selecting a filter preset and...
... clicking a GimpChain.
Since commit c0c055b4e9, gimp_chain_button_set_active() emits the
"toggled" signal. There is no need to emit it separately from
GimpOperationTool when setting presets with
gimp_operation_tool_set_config().

In particular, since the "toggled" signal was even sent unconditionnally
here, our code was ending creating several GBinding for the same 2
adjustments, which was creating an infinite loop.
2019-03-20 14:48:40 +01:00
Jehan af6760b3c9 app: fixes g_object_unref: assertion 'G_IS_OBJECT (object)' failed.
"binding" data can be set to NULL. Do not assume it is a proper object.

Also I was tempted to use g_object_set_data() to simply free the
GBinding object on setting a new data, but such object will also be
freed when the widget is destroyed by default. So that would also end up
in double destruction. Instead just keep current logics.

This CRITICAL was reported in #3133 but this is not the main bug.
2019-03-20 14:06:18 +01:00
Jehan 7cf06c3f60 app: color widget updated properly when editing colors.
Also note that GimpColorPanel doesn't need to react differently whether
GimpColorDialog returned OK or CANCEL, as the dialog keep track and
return the appropriate color to set in the end of the process.
2019-03-20 11:21:46 +01:00
Jehan 425eb83f8a app: GimpColorDialog follows the user context active image.
(when working in context-aware mode)
2019-03-19 13:37:18 +01:00
Jehan 3dc820c017 app: make active_image member a weak pointer in GimpColorDialog.
This fixes signal handler disconnections wrongly run on images which
have already been freed.
2019-03-18 23:36:31 +01:00
Jehan 0ae3f38f52 Issue #3122: gimp_color_dialog_constructed: 'colormap' action group...
... not found.
So it turns out I cannot just gtk_action_group_get_action("colormap") as
the related action group is not registered unless the Colormap dockable
is opened. Anyway I mostly needed to get icons and tooltips from these
actions. Let's just copy the strings and be done with it.
This still feel a bit like duplicate code but it's not too bad, so…
2019-03-18 17:57:08 +01:00
Jehan 3b0e4d8760 app: update padding color interactively.
We should see the padding color change as we tweak the color dialog to
make it more useful.
2019-03-18 14:58:05 +01:00
Jehan edb90672fb app: again properly disconnect signal handlers. 2019-03-18 14:37:32 +01:00
Jehan 4a3da7d05e app: properly disconnect signal handlers. 2019-03-18 14:02:30 +01:00
Jehan c2ab385207 app: some cleanup in GimpColormapEditor.
I should have cleaned better earlier. :-/
Also add back some horizontal alignment in the colormap entry edit
widgets. This got lost during moving apparently!
2019-03-18 13:00:42 +01:00
Jehan 6e84c47469 app: use a GtkStack instead of GtkNotebook in GimpColorDialog.
This was the original plan since it is closer conceptually to the widget
idea, but I started working on gimp-2-10 where GtkStack was not
available (as it appears in GTK+3).
2019-03-18 12:28:02 +01:00
Jehan 576e804ebf app: make the active_image into a weak pointer.
We should make sure the object exists before using it.
2019-03-18 12:15:18 +01:00
Jehan 6abb55c759 app: GimpColorDialog should actually follow the user context...
... and not the GimpContext passed in.
What we are indeed interested in is the currently active image which is
recorded in the user context.
2019-03-18 12:11:58 +01:00
Jehan 8ab04a2a3a app: use the new GimpColormapSelection in GimpColormapEditor.
Code from GimpColormapSelection is mostly coming from GimpColormapEditor
anyway, except that it is used elsewhere as well.
2019-03-18 12:10:44 +01:00
Jehan 94043529c8 Issue #2938: Painting on indexed images counter-intuitive.
When loading indexed images, the image type is not obvious at all
(basically only reference is in the title bar). The main issue is that
if you don't realize it when editing, GIMP appear broken when the
expected colors don't appear on canvas.
Commit e48c239459 was a first step by showing various color widgets with
out-of-gamut warnings contextually. This additional commits will also
allows color selection for painting tools (i.e. foreground and
background colors) to be done within the image palette by default. This
way, the fact that this image impose working with limited color palette
is obvious as soon as you try to edit colors.
2019-03-18 12:06:11 +01:00
sabri ünal d5ea4c5653 Typo - Preceptual changed to Perceptual 2019-03-14 16:47:39 +00:00
Ell 506f412a05 app: avoid pushing undo while updating colormap entries
In GimpColormapEditor, while updating a colormap entry, only push
an undo step when confirming the new color.
2019-03-13 10:57:09 -04:00
Ell 1e89c161c5 app: more "Readjust" improvements
... technical stuff.
2019-03-13 10:12:08 -04:00
Ell a3fa3b6181 app: improve transform-tools readjustment
In GimpTransformGridTool, extend the functionality of the
"Readjust" button, such that if the transformation is already
adjusted to the view (i.e., when the button is clicked the second
time), readjust the transformation to the item bounds (as when
using the tool "normally"), and vice versa.  This allows switching
back and forth between "normal" mode, and "adjusted-to-view" mode.

Additionally, disable readjustment when the current transforamtion
is invalid, and show an error when readjustment results in an
invalid transformation.
2019-03-13 05:28:29 -04:00
Ell 92216a635a app: in gimp_tool_gui_set_response_sensitive(), allow non-existent ID
In gimp_tool_gui_set_response_sensitive(), silently ignore non-
existent response IDs, instead of emitting a CRITICAL, to match the
behavior of GtkDialog and GimpOverlayDialog.  This simplifies code
with optional dialog responses.
2019-03-13 05:28:29 -04:00
Alexandre Prokoudine fbde5da3b8 Tools presets -> Tool Pre_sets. Fixes #3092 2019-03-11 23:49:46 +03:00
Ell 8954d1f386 libgimpwidgets, app, plug-ins: use GimpSpinButton everywhere
Replace all direct uses of GtkSpinButton with GimpSpinButton, so
that its modified behavior extends to all our spin buttons.
2019-03-09 07:28:52 -05:00
Ell 46e16e175c app: take transform-grid handle size into account when readjusting
In the unified-transform, scale, and perspective tools, take the
maximal transform-grid handle size into account when readjusting
the transform, so that the handles themselves are fully within view
under arbitrary rotation, rather than just the corners.
2019-03-08 12:11:13 -05:00
Jehan f6bfc2f23b app: update fg/bg colors when committing a colormap change.
Since the color being currently edited is the selected one, it makes
sense that the fg/bg color should be updated appropriately.

(cherry picked from commit 628960ed22)
2019-03-08 17:39:08 +01:00