This implements https://phabricator.kde.org/T1565
Details
Diff Detail
- Repository
- R37 Krita
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Hi, @zachmann!
Here is a small complication in this bug. The selection can be default (entire image is selected) and can be user-selected (of any custom shape). The default
Hi, @zachmann!
Here is a small complication in this bug. The selection can be default (entire image is selected) and can be user-selected (of any custom shape). The default selection should be expanded automatically when the image resizes, and the custom one should not. Please see the attached video showing the bug in the patch:
What is more, the selection should be edited only if the image has been "resized", not "scaled". Because the scale operation expands the selection accordingly if needed.
Actually, we have the same problem with transparency masks. And the problem is solved quite differently. It doesn't connect to any signals. Just during the initialization phase (in KisMask::initSelection) it sets the default pixel of the selection to "all selected". And when the image size is changed, the new extent of the mask is returned automagically using the defaultBounds() functionality. As far as I remember, the main problem was to connect that selection to the correct defaultBounds source correctly, because otherwise it returns infinite rect, which usually needs infinite time to update :)
I think the issues with the weak pointers come from the way we started using them: as a way to refer to the document's image without creating leaks by keeping strong pointers around. The image would (almost) always be valid because the document owns the image. So until we started cloning images to save them without also cloning the owning document, like we do now, the usage was "safe".
Not that fixing this isn't a good thing, this is just a bit of background...
Found in my comments that Dmitry has already committed this in 8af9d2d9445428ce89c23a465cfc68039437affa