Resize generator layer on canvas resize
AbandonedPublic

Authored by zachmann on May 1 2016, 4:45 AM.

Details

Reviewers
dkazakov
rempt
Group Reviewers
Krita
Summary
Test Plan

Tested that resizing (bigger/smaller) the image works. Tested that the resized image is stored/loaded correctly.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
zachmann updated this revision to Diff 3585.May 1 2016, 4:45 AM
zachmann retitled this revision from to Resize generator layer on canvas resize.
zachmann updated this object.
zachmann edited the test plan for this revision. (Show Details)
zachmann added reviewers: Krita, dkazakov, rempt.
zachmann set the repository for this revision to R37 Krita.
zachmann added a project: Krita.
Restricted Application added a subscriber: woltherav. ยท View Herald TranscriptMay 1 2016, 4:45 AM
dkazakov edited edge metadata.May 2 2016, 9:43 AM

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

dkazakov requested changes to this revision.May 2 2016, 9:54 AM
dkazakov edited edge metadata.

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 :)

This revision now requires changes to proceed.May 2 2016, 9:54 AM
gladhorn added inline comments.
libs/image/generator/kis_generator_layer.cpp
58

image is a weak pointer, it should be converted to a real pointer before usage.

100

this may crash, image() returns a weak pointer.

rempt edited edge metadata.Nov 14 2016, 4:14 PM

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...

rempt requested changes to this revision.Nov 2 2017, 9:14 AM

Ping? Thorsten, can you check the issues with the pointers and update the patch?

zachmann abandoned this revision.Dec 8 2017, 5:30 AM

Found in my comments that Dmitry has already committed this in 8af9d2d9445428ce89c23a465cfc68039437affa