Bug 394439

Summary: drawing change the bounds of a layer beyond the selection
Product: [Applications] krita Reporter: radian <xenys25>
Component: Layer StackAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: minor CC: dimula73, griffinvalley, rjquiralte
Priority: NOR Keywords: regression
Version: 4.0.3   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: show the problem

Description radian 2018-05-19 09:24:35 UTC
Created attachment 112747 [details]
show the problem

Drawing change the bounds of a layer beyond even if layer have alpha lock or some selection.
Comment 1 Quiralta 2018-06-12 13:57:28 UTC
I can confirm that this behavior still present in git-master branch.

On Linux system.
Comment 2 Dmitry Kazakov 2020-06-02 14:47:12 UTC
Git commit f4ed0c96778eab59979b2a79ab87bd689f7c07b6 by Dmitry Kazakov.
Committed on 02/06/2020 at 14:46.
Pushed by dkazakov into branch 'master'.

Fix layer's bounds extending when painting outside the selected area

When blitting the brush outside selected area we shouldn't actually
write-access pixels. Every write-access extends the extent of the
paint device, which is not what we want.

M  +16   -0    libs/image/kis_painter.cc

https://invent.kde.org/graphics/krita/commit/f4ed0c96778eab59979b2a79ab87bd689f7c07b6
Comment 3 Dmitry Kazakov 2020-06-02 14:47:13 UTC
Git commit ed7b043305a9d419c7e6b57bd0190e8bec4fe6a5 by Dmitry Kazakov.
Committed on 02/06/2020 at 14:46.
Pushed by dkazakov into branch 'master'.

Disable doing bitBlt outside extent when alpha channel is locked

The the user paints outside the contours of the layers with alpha
channel locked, we shouldn't do noop-writes to the layer. Instead,
we should just skip these areas alltogether.

M  +13   -0    libs/image/kis_painter.cc

https://invent.kde.org/graphics/krita/commit/ed7b043305a9d419c7e6b57bd0190e8bec4fe6a5
Comment 4 Dmitry Kazakov 2020-06-02 14:47:13 UTC
Git commit cef5f3528ec2fbbee8878c55648dee05254c0275 by Dmitry Kazakov.
Committed on 02/06/2020 at 14:46.
Pushed by dkazakov into branch 'master'.

Make sure layer thumbnail's size is calculated using the projection itself

We shouldn't use layer->extent() for the thumbnail generation, because
extent may also include indirect painting device, which may have a
different size, not like the one of projection (e.g. when selection is
active).

M  +5    -2    libs/image/kis_base_node.cpp
M  +2    -2    libs/image/kis_base_node.h
M  +4    -4    libs/image/kis_layer.cc
M  +2    -2    libs/image/kis_layer.h
M  +2    -2    libs/image/kis_mask.cc
M  +1    -1    libs/image/kis_mask.h
M  +11   -0    libs/image/kis_paint_device.cc
M  +10   -0    libs/image/kis_paint_device.h
M  +2    -2    libs/image/kis_selection_based_layer.cpp
M  +1    -1    libs/image/kis_selection_based_layer.h
M  +1    -1    libs/libqml/plugins/kritasketchplugin/models/LayerModel.cpp
M  +1    -9    libs/ui/kis_node_model.cpp
M  +1    -7    plugins/dockers/animation/timeline_frames_model.cpp

https://invent.kde.org/graphics/krita/commit/cef5f3528ec2fbbee8878c55648dee05254c0275
Comment 5 Dmitry Kazakov 2020-06-02 14:47:20 UTC
Git commit 2b5ed5a0bdb23812c4b64e4ed7d657a5acff85ca by Dmitry Kazakov.
Committed on 02/06/2020 at 14:43.
Pushed by dkazakov into branch 'krita/4.3'.

Fix layer's bounds extending when painting outside the selected area

When blitting the brush outside selected area we shouldn't actually
write-access pixels. Every write-access extends the extent of the
paint device, which is not what we want.

M  +16   -0    libs/image/kis_painter.cc

https://invent.kde.org/graphics/krita/commit/2b5ed5a0bdb23812c4b64e4ed7d657a5acff85ca
Comment 6 Dmitry Kazakov 2020-06-02 14:47:21 UTC
Git commit 4aba1910f128b4827a093f9b5f26db830fbd2edd by Dmitry Kazakov.
Committed on 02/06/2020 at 14:43.
Pushed by dkazakov into branch 'krita/4.3'.

Make sure layer thumbnail's size is calculated using the projection itself

We shouldn't use layer->extent() for the thumbnail generation, because
extent may also include indirect painting device, which may have a
different size, not like the one of projection (e.g. when selection is
active).

M  +5    -2    libs/image/kis_base_node.cpp
M  +2    -2    libs/image/kis_base_node.h
M  +4    -4    libs/image/kis_layer.cc
M  +2    -2    libs/image/kis_layer.h
M  +2    -2    libs/image/kis_mask.cc
M  +1    -1    libs/image/kis_mask.h
M  +11   -0    libs/image/kis_paint_device.cc
M  +10   -0    libs/image/kis_paint_device.h
M  +2    -2    libs/image/kis_selection_based_layer.cpp
M  +1    -1    libs/image/kis_selection_based_layer.h
M  +1    -1    libs/libqml/plugins/kritasketchplugin/models/LayerModel.cpp
M  +1    -9    libs/ui/kis_node_model.cpp
M  +1    -7    plugins/dockers/animation/timeline_frames_model.cpp

https://invent.kde.org/graphics/krita/commit/4aba1910f128b4827a093f9b5f26db830fbd2edd
Comment 7 wolthera 2020-07-25 20:03:24 UTC
Hey, so, ed7b043305a9d419c7e6b57bd0190e8bec4fe6a5 (and 2b5ed5a0bdb23812c4b64e4ed7d657a5acff85ca) break using the colorsmudge and filter brush engines inside a selection. I've revert that commit in master, but couldn't revert it cleanly in 4.3

Probably what is going on is that the temporary paintdevice used by these engines is inappropriately affected by the selection? (Clone and deform brush have no issues, btw).

Because this now unfixed in master, and fixed but causing a regression in 4.3, I'm reopening and marking it as a regression.
Comment 8 wolthera 2020-07-25 20:10:32 UTC
I unreverted the commit I had reverted because I wasn't paying attention.
Comment 9 Dmitry Kazakov 2020-07-27 14:12:22 UTC
Git commit a899f2f42800f546105e2fbe53d37e4b1b355b45 by Dmitry Kazakov.
Committed on 27/07/2020 at 14:08.
Pushed by dkazakov into branch 'master'.

Fix painting with colorsmudge brush when a selection is active

Selection crops destination rect, not the source one
Related: bug 423851

M  +17   -8    libs/image/kis_painter.cc

https://invent.kde.org/graphics/krita/commit/a899f2f42800f546105e2fbe53d37e4b1b355b45
Comment 10 Dmitry Kazakov 2020-07-27 14:23:08 UTC
Git commit c4d0924a66b8dbc6e61f38aa5fb61cc5c03ac444 by Dmitry Kazakov.
Committed on 27/07/2020 at 14:13.
Pushed by dkazakov into branch 'krita/4.3'.

Fix painting with colorsmudge brush when a selection is active

Selection crops destination rect, not the source one
Related: bug 423851

M  +17   -8    libs/image/kis_painter.cc

https://invent.kde.org/graphics/krita/commit/c4d0924a66b8dbc6e61f38aa5fb61cc5c03ac444