Stroke path or selection has an offset in a layer that has an offset.
V2.99.12 flatpak and 2.99.13 self-build on Linux Mint 21.0
If a path is stroked with a paint tool when a layer with a non-zero offset (layer "Background" in the attached file) is selected the line drawn has an offset which is equal to the layer offset but of the opposite sign. If another layer in the image that has no offset is selected (layer "Layer" in the attached file) when the path is stroked the line drawn is not offset.
To create a file that shows the problem:
-
"File/New..." to create a new file 640 x 640 pixels RGB colour, filled with background colour.
-
Make sure that the foreground colour is different to the background colour.
-
Use the Path tool to draw a single straight diagonal line path with just 2 points (it doesn't matter if the path is created at this stage or after the next step to resize the canvas).
-
"Image/Canvas Size..." Set the new width to 720 x 720 pixels then click the "Centre" button and set "Resize layers" = None and "Fill with" Transparency the click "Resize"
-
Use the Paths dialog to make the path visible.
-
Mark the position of one end of the path using a vertical and a horizontal guide.
-
"Edit/Stroke Path..." - select "Stroke with a paint tool" then click "Stroke" - a line is drawn parallel to the path but shifted up and left by 40 pixels.
If the "Stroke line" option is selected (instead of "Stroke with a paint tool") then the offset does not appear.
This does not happen if the layer is the same size as the canvas or the origin of the layer is coincident with the origin of the canvas.
StrokeOffsetIssue.7z StrokeOffsetIssue.xcf
Stroking a rectangular, elliptical or freehand selection when the layer with the offset is selected also shows the problem when it is stroked with a paint tool. This is also the case if there is one or more layers that are the full size of the canvas selected at the same time as the offset layer.
I have identified places in gimp_paint_core_stroke_vectors() and gimp_paint_core_stroke_boundary() that apply the drawable offset to the stroke - in V2.99 this is unnecessary. I will submit an MR for this tomorrow.