Commit Graph

3177 Commits

Author SHA1 Message Date
b49c062fa4 New upstream version 2.10.34 2023-03-01 18:41:57 -05:00
6adf574513 app: don't draw the drop zone, just nothing when converting. 2023-02-19 18:53:42 +01:00
de25be9210 app: fix a crash when converting to higher precision.
gimp_display_shell_render() writes to a GeglBuffer backed by allocated memory
(shell->profile_data). Unfortunately while converting prevision in
gimp_image_convert_precision(), we change the "precision" property (hence the
source format) first, hence end up trying to write data in a too small buffer.
This crash was hard to find as it was not showing up on my machine (though it
did produce rendering artifacts!), unless I built both GIMP and babl with
`b_sanitize=address`.

Note that an alternate fix was to make sure that the profile_data buffer is big
enough (by calling gimp_display_shell_profile_update() before rendering), but
anyway the image is in an inconsistent state while conversion is in progress:
whereas the `src_format` is the new one, the `src_profile` is still the old one
(and cannot be changed before we finish converting).

Moreover the render happen regularly on progress signals, once after each
converted drawable. So each of these rendering step happens in an inconsistent
state, with the wrong profile set, some of the drawables converted and others
not yet.
We could still render properly if each drawable's buffer used space-aware format
(thus allowing different drawables to use different profiles/spaces), but it
feels over-engineering the problem. It might be much better to ignore rendering
steps while converting the image precision. Moreover it would obviously make a
faster conversion.

See discussions in #9136 for this crash, which didn't have dedicated report
AFAIK.
2023-02-19 18:30:18 +01:00
c9f518a65c display: Fix statusbar tool icon offset
The Y offset of the statusbar tool icon is too large, which pushes it
off-screen. This scales the offset by the size of the icon to
prevent this problem.
2023-02-09 14:19:23 +00:00
d6d2e56c00 app: Fix "Handle Transform" handle snap location 2023-01-02 15:31:59 -05:00
30c23df646 New upstream version 2.10.32 2022-08-01 09:14:18 -04:00
52519f1290 New upstream version 2.10.30 2021-12-27 21:32:02 -05:00
6be014fc59 app: replace using the "draw" signal by "expose-event" on GTK+2.
Not sure why but adding a handler to the "expose-event" signal of
GimpDisplayShell (similarly to how we do it in master branch on "draw")
just didn't work. But it works on the already existing signal handling
on the canvas instead (which actually is not a bad deal, as we also
remove the coordinates translation so maybe we should test this on
`master` too).

Note: why we are backporting all this logics to gimp-2-10 is because
changes in macOS BigSur broke the selection's marching ants the same way
they broke on Wayland and it was confirmed this fix worked for BigSur as
well, at least on the dev builds.
It is unnecessary to backport for Wayland (because GIMP 2.10 is based on
GTK2 which anyway works only through XWayland, hence doesn't have the
issue), we do it only for macOS BigSur (and further). Well at least the
fix will hopefully work on the stable branch, because I cannot test
myself.

See issue #5952.
2021-10-22 23:22:39 +02:00
16adb3bf3d app: replace gtk_widget_queue_draw_region() with…
gtk_widget_queue_draw_area().

gtk_widget_queue_draw_region() has been introduced in GTK 3.0.
2021-10-22 23:15:40 +02:00
71b23da329 app: add back a timeout-based idle function to queue a canvas redraw.
I'm still very unclear why exactly but it would seem that just queuing
the redraw with an idle function is not enough. At least on Windows,
Jacob was having cases where opening an image would get stuck unless the
mouse was moved (causing draw events most likely).

So let's use a timeout function instead. Probably no need to queue the
idle followed by the timeout function as we had before commit
4fee04b839. Instead just directly queue a draw if relevant, then run the
timeout at regular interval (marching ants speed).

(cherry picked from commit 668c9de5a5)
2021-10-22 23:15:40 +02:00
9314ba7051 app: check the time before last selection draw before queuing a redraw.
This way, we would queue a lot less canvas region unnecessary redraws.
We still remake the time-before-last-draw check in the draw() signal
handling before we want to update the marching ants index for draw
events coming for other reasons (canvas updates, moving/zooming on
canvas, exposition changes, etc.).

(cherry picked from commit 6466d46052)
2021-10-22 23:15:40 +02:00
73b40f4183 app: fix selection display on right/bottom borders when rulers are…
… displayed.

We should use the dimensions from the GimpDisplayShell not the the
GimpCanvas. Indeed the canvas is shorter when rulers are visible, hence
the selection next to the extreme sides (bottom and right sides of the
canvas) was not drawn.

(cherry picked from commit e8a531e51e)
2021-10-22 23:15:40 +02:00
c3b35fd601 Issue #5640: Selection tools not showing selection on Wayland.
As suggested in a comment (itself coming from an IRC discussion), we
should not use gdk_window_(begin|end)_draw_frame() functions as this
works on X, but not on Wayland anymore. Instead draw directly during
draw() call of the shell widget, and force it to happen regularly, to
update the marching ants, via gtk_widget_queue_draw_region().

This is tested and works on Wayland. Please everyone, test thoroughly to
make sure it works well in all situations, and also that we don't get
any unexpected slowdowns.

Since the symptoms are very similar, it is highly possible that it also
fixes the issue #5952 too, for selection not showing on macOS since Big
Sur 11 (maybe they changed the same way as Wayland did). Unfortunately I
can't check this myself. Please test, whoever has access to a macOS Big
Sur and can build GIMP!

(cherry picked from commit 4fee04b839)
2021-10-22 23:15:40 +02:00
1ff0cc1f5c New upstream version 2.10.28 2021-09-19 12:12:14 -04:00
6c74aa8490 New upstream version 2.10.24 2021-07-18 14:31:43 -04:00
f63086bd5a tools: Rectangle select. Incorrect center_xy after converting channel selection to rectangle
Was caused by widget tool fixed_center_x and fixed_center_y coordinates set to
coordinates of mouse click instead of rectangle center after converting channel
selection bbox to rectangle.

Now rectangle fixed_center_x and fixed_center_y coordinates are always updated
when tool widget x1, x2, y1, or y2 coordinates are updated.

Closes #6487

(cherry picked from commit 6959426603)
2021-02-24 19:05:42 +01:00
22db7695c8 Issue #288: Point snapping to guides does not work outside the canvas.
This commit also makes snap to grid and snap to vectors work off-canvas.
Since we now have off-canvas viewing, it just makes sense that snapping
would work there too.

Note that I disable snap to grid when "Show All" is OFF. I am actually
unsure this is right (as "Show All" is a view action, and we usually
don't change behavior based on view actions; for instance snap to guides
are not disabled if guides are hidden). Yet I noticed we do this in
various other features when off-canvas. We kind of use this view flag as
a switch for features working off-canvas (for instance, color picking
works off-canvas only when "Show All" is ON). So let's keep the same
logics for now at least.

Snap to guide or snap to vectors will always work though, because guides
and vectors are always visible off-canvas (even when "Show All" is OFF).
They always have been (visible, not snappable off-canvas; now they are
both).

(cherry picked from commit 82438728fb)
2021-02-13 13:11:27 +01:00
c6b46b63b5 New upstream version 2.10.20 2020-08-26 11:05:56 +01:00
Ell
0c4e6f1ef3 app: update tool widgets on display-shell changes more granularly
Partially revert commit c73710e410,
avoiding updating tool widgets unconditionally on tool resume in
GimpDrawTool -- it's too expensive in general.

Instead, handle display-shell changes in GimpToolWidget, by adding
GimpToolWidget::update_on_{scale,scroll,rotate} flags, which
subclasses can use to request an update on any of these events.

Set the flags as necessary for the affected widgets.

(cherry picked from commit afda774f44)
2020-05-26 10:46:44 +03:00
Ell
cf80b43b03 app: fix compiler warnings in GimpToolWidget
(cherry picked from commit ec69083354)
2020-05-26 10:46:17 +03:00
Ell
3e61ef9ae6 app: fix alignment of generic pixel buffers
Wherever we store arbitrary-format colors in an opaque buffer, use
double for the buffer, instead of char, so that it has a strict-
enough alignment to handle all our used pixel formats.

(cherry picked from commit a90f59d961)
2020-05-20 08:54:31 +03:00
Ell
f000e40590 Revert "app: update display-enums.c"
The updated display-enums.h isn't in gimp-2-10 yet :P

This reverts commit 3899d75a98.
2020-05-16 16:02:58 +03:00
Ell
bd892491f4 app: fix CRITICAL when using "show all" by default
When using "show all" by default, gimp_display_flush() can be
called during GimpDisplayShell construction, before the newly-
constructed shell is assigned to the display.  Use an ugly hack to
just ignore the flush when this happens.

(cherry picked from commit 0a06294af7)
2020-05-16 15:59:25 +03:00
Ell
3899d75a98 app: update display-enums.c
(cherry picked from commit bc13dc80dd)
2020-05-16 15:59:17 +03:00
Ell
60db24b655 app: another fix in GimpToolFocus
(cherry picked from commit 1171798ca6)
2020-05-15 13:39:53 +03:00
Ell
03fcb782a6 app: various fixes in GimpToolFocus
(cherry picked from commit 2fcf667efd)
2020-05-15 12:34:04 +03:00
Ell
92baa76e11 app: fix signature of gimp_canvas_limit_new()
... and gimp_tool_widget_add_limit().

(cherry picked from commit 9fe589734b)
2020-05-15 00:56:06 +03:00
Ell
36b3745d10 app: add GimpToolFocus tool widget
Add a new GimpToolFocus tool widget, which defines a focus region,
consisting of an inner limit, an outer limit, and a transition
midpoint between them.  The widget allows controlling the limits
and the midpoint, and moving, scaling, and rotating the region.

(cherry picked from commit 5e005a762c)
2020-05-15 00:49:46 +03:00
Ell
d9ef974d43 app: add gimp_tool_widget_add_group()
... which adds a regular (non-filling, non-stroking) canvas-item
group to the widget.

(cherry picked from commit 1a8f0b6cd6)
2020-05-15 00:49:41 +03:00
Ell
24a7a3d27b app: add gimp_display_shell_constrain_angle()
... which constrains an angle to discrete increments in screen
space, similarly to gimp_display_shell_constrain_line().

(cherry picked from commit 8c1a277007)
2020-05-15 00:49:41 +03:00
Ell
ecf131ed0c app: add GimpCanvasLimit canvas item
Add a new GimpCanvasLimit canvas item, which draws an area limit
for different shapes.  It will be used by the following commits to
implement GimpToolFocus.

(cherry picked from commit 06a2b4f338)
2020-05-15 00:49:40 +03:00
Ell
bd00527fe5 app: in GimpDrawTool, update widget on tool resume
In GimpDrawTool, update the tool widget on GIMP_TOOL_ACTION_RESUME,
so that it can respond to changes in the display-shell scale/
offset.  We'd previously done that for individual tools/widgets,
but let's just do it in one place.

(cherry picked from commit c73710e410)
2020-05-15 00:49:08 +03:00
Ell
c4061c01aa app: pause/resume active tool when rotating canvas
In GimpDisplayShell, pause and restore the active tool when
rotating the canvas, similarly to scrolling and scaling.

(cherry picked from commit cd5e4e99dd)
2020-05-15 00:49:07 +03:00
Ell
a6c095b02d app: make sure to update the display-shell title/statusbar when closing image
... instead of relying on UI events to cause this indirectly.

(cherry picked from commit 37065ccf6f)
2020-04-19 18:02:45 +03:00
Ell
2cbb08595c Issue #4968 - Newly opened image not visible in image window ...
... when rulers and scrollbars are hidden

In gimp_display_shell_fill(), make sure a size-allocate always
happens for the canvas, even when the rulers and scrollbars are
hidden, so that the pending size_allocate_center_image is handled,
and doesn't block canvas drawing.

(cherry picked from commit 4e560f2ff0)
2020-04-19 18:02:45 +03:00
a66f88287c app: add missing includes for windows
(cherry picked from commit 46f706a403)
2020-04-13 11:57:38 +02:00
8e7900cbf2 New upstream version 2.10.18 2020-03-29 00:23:03 -04:00
83da81f308 Fix typos
Found via `codespell -q 3 -S ./ChangeLog*,*.po -L als,ang,ba,chello,daa,doubleclick,foto,hist,iff,inport,klass,mut,nd,ower,paeth,params,pard,pevent,sinc,thru,tim,uint`

(cherry picked from commit a928452eba)
2020-03-17 13:36:59 +01:00
Ell
50ef78a52e app: increase display update rate
Now that painting is done in a separate thread, the display update
rate has a far smaller impact on it.  Increate the GimpDisplay
update rate, which handles image updates, to 60 FPS, and the
GimpDrawTool update rate to 120 FPS.  In particular, the latter
change makes brush-outline motion much smoother.
2020-02-04 17:51:14 +02:00
Ell
a1eb04ea71 app: in GimpCanvasBufferPreview, take strong ref on buffer
In GimpCanvasBufferPreview, take a strong reference on the preview
buffer, fixing a segfault in the foreground-select tool when
switching engines while the grayscale preview is active.

(cherry picked from commit ea864e2d5c)
2020-02-03 21:21:17 +02:00
Ell
f4dc0fd147 app: in GimpCanvasBufferPreview, add support for offset buffers
Ditto.

(cherry picked from commit 43f8a5199f)
2020-02-03 21:21:17 +02:00
Ell
e884af8f42 app: clip transform-tools preview according to clipping mode
Add a "clip" property to GimpCanvasTransformPreview, specifying the
transform's clipping mode, and clip the preview accordingly.

In GimpTransformGridTool, sync the tool's clipping mode with the
preview's clipping mode.

(cherry picked from commit 7b2e6b7595)
2020-01-11 17:13:11 +02:00
Ell
41a8be5b2a app: fix spacing in gimptooltransform3dgrid.c
(cherry picked from commit d79ef34f87)
2020-01-10 23:21:41 +02:00
Ell
87d3590054 app: add unified interaction mode to the 3D Transform tool
Add a "Unified interaction" option to the 3D Transform tool, and a
corresponding "unified" property to GimpToolTransform3DGrid.  When
active, all three interaction modes of the grid (camera, move, and
rotate) are available simultaneously, regardless of the active
dialog page.  In this mode, the inner and outer regions of the item
are used for moving and rotation, respectively, and the vanishing-
point is controlled through through a handle.

(cherry picked from commit 30132fc2da)
2020-01-10 23:21:41 +02:00
Ell
c4d0c0bd6d app: in 3D Transform tool, fix rotation direction when rotating arouns local Z axis
In GimpToolTransform3DGrid, fix the test for determining which side
of the plane is facing the viewer, affecting the direction of
rotation when rotating around the local Z axis.

(cherry picked from commit bcaaa453c4)
2020-01-10 22:18:09 +02:00
Ell
855eb0a150 app, cursors: add GimpToolTransform3DGrid tool widget
Add a new GimpToolTransform3DGrid tool widget, subclassed from
GimpToolTransformGrid, which can be used to perform 3D
transformations.

The widget can be in one of three modes:

  CAMERA - allows adjusting the primary vanishing point by moving a
  handle.

  MOVE   - allows moving the object through dragging.

  ROTATE - allows rotating the object through dragging.

By default, controlling the transformation through dragging applies
to the X and Y axes.  Holding Shift (or setting the "constrain-
axis" property) restricts the motion to only one of the axes.

For the MOVE and ROTATE mode, holding Ctrl (or setting the "z-axis"
property) allows controlling the Z axis instead.

For the same modes, holding Alt (or setting the "local-frame"
property), applies the adjustments in the object's local frame of
reference, instead of the display's global frame of reference.
2020-01-06 23:10:04 +02:00
Ell
d0ccd6ecfb app: add a protected gimp_tool_transform_grid_get_handle() function
... which can be used by subclasses to retrieve the currently-
active handle.
2020-01-06 23:10:04 +02:00
Ell
d30d47a0fd app: add GimpTransformGridTool::dynamic-handle-size property
Add a boolean GimpTransformGridTool::dynamic-handle-size property,
which controls whether the handle sizes are adjustment dynamically
according to the grid's size, or remain fixed.  This property is
TRUE by default, to maintain the current behavior.
2020-01-06 23:10:04 +02:00
Ell
cd7ccdf310 app: in GimpToolTransformGrid, add NONE function
In GimpToolTransformGrid, allow setting "inside-function" and
"outside-function" to a new NONE value, performing no
transformation when dragging the respective area.
2020-01-06 23:10:04 +02:00
Ell
65d5cd5daf app: fix indentation in gimptoolsheargrid.c 2020-01-06 23:10:04 +02:00