Bug 425831

Summary: Strokes on Colorize Mask are in wrong place after cropping the image and saving
Product: [Applications] krita Reporter: Tiar <tamtamy.tymona>
Component: ToolsAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73
Priority: NOR    
Version: 4.3.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Test file - crop to the smiley face, save and open in a new tab to see the issue
File after cropping and saving

Description Tiar 2020-08-26 12:32:52 UTC
Created attachment 131198 [details]
Test file - crop to the smiley face, save and open in a new tab to see the issue

SUMMARY
When you have a Colorize Mask in your file and you crop the file and save, next time you open the file the strokes will be in a wrong place.

STEPS TO REPRODUCE
1. Open or create a file with Colorize Mask in a top right corner.
2. Crop the file to that one corner only.
3. Save.
4. Open the file.

OBSERVED RESULT
The preview looks good, but the strokes are in a wrong place. If you update, the result will be wrong.

EXPECTED RESULT
Strokes are in the same place as they were before cropping.

Important: After cropping but before saving strokes are still in the correct place, only saving and opening cause the issue.

After fixing the strokes and saving again, the issue reappears. It suggest problems on loading the Colorize Mask, not saving, then. Not sure why cropping would affect that though - here I'm talking only about moving the strokes using the Move Tool and saving, without using the Crop Tool again.

SOFTWARE/OS VERSIONS
Krita

 Version: 4.3.0
 Languages: en_US, en, en_US, en, en_US, en, pl_PL, pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.12.8
  Version (loaded): 5.12.8
Comment 1 Tiar 2020-08-26 12:33:11 UTC
Created attachment 131199 [details]
File after cropping and saving
Comment 2 Dmitry Kazakov 2020-08-27 14:07:47 UTC
Git commit c6ccd134864e474a75671863d0f731774340f0ec by Dmitry Kazakov.
Committed on 27/08/2020 at 14:07.
Pushed by dkazakov into branch 'krita/4.3'.

Fix saving/loading colorized masks after cropping them

The key strokes' metadata doesn't store the offset, the offset
should be copied from the mask itself.

M  +24   -0    libs/global/kis_dom_utils.h
M  +2    -1    plugins/impex/libkra/kis_colorize_dom_utils.cpp
M  +4    -1    plugins/impex/libkra/kis_colorize_dom_utils.h
M  +6    -1    plugins/impex/libkra/kis_kra_load_visitor.cpp

https://invent.kde.org/graphics/krita/commit/c6ccd134864e474a75671863d0f731774340f0ec
Comment 3 Dmitry Kazakov 2020-08-27 14:08:07 UTC
Git commit b9396267ecebd89f20c129f843c6e3c953d3722b by Dmitry Kazakov.
Committed on 27/08/2020 at 14:08.
Pushed by dkazakov into branch 'master'.

Fix saving/loading colorized masks after cropping them

The key strokes' metadata doesn't store the offset, the offset
should be copied from the mask itself.

M  +24   -0    libs/global/kis_dom_utils.h
M  +2    -1    plugins/impex/libkra/kis_colorize_dom_utils.cpp
M  +4    -1    plugins/impex/libkra/kis_colorize_dom_utils.h
M  +6    -1    plugins/impex/libkra/kis_kra_load_visitor.cpp

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