Bug 304369 - mask origin is messed up on saving/loading
Summary: mask origin is messed up on saving/loading
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR critical
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-01 06:42 UTC by Halla Rempt
Modified: 2012-10-31 11:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
image with mask to play with (882.62 KB, application/x-krita)
2012-08-01 06:42 UTC, Halla Rempt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Halla Rempt 2012-08-01 06:42:14 UTC
The origin of a mask is wrong after saving and loading an image. 

Reproducible: Always

Steps to Reproduce:
1. create an image
2. create a (transparency mask)
3. crop or move the mask around
4. save
5. load
Actual Results:  
The mask is shown offset to the bottom-right.

Expected Results:  
It should be in the correct location

06:06:01  * PovAddict runs in circles screaming
06:08:45  * eages gets back and is mildly confused.
06:09:23 < PovAddict> krita messed up my handiwork when I saved it
06:09:55 < PovAddict> I fixed it, saved file, closed krita, reopened the file and it's messed up in the same way again
06:09:57  * PovAddict is not amused
08:32:40 < boud> PovAddict: that sounds serious. What happened exactly?
08:32:52 < PovAddict> I'll try to repro with a simpler case later
08:32:57 < PovAddict> I made a large canvas
08:33:06 < PovAddict> pasted two images as layers (both smaller than the canvas)
08:33:17 < PovAddict> changed their positions
08:33:33 < PovAddict> carefully and timeconsumingly created a transparency mask on the top layer
08:34:17 < PovAddict> finally I cropped the canvas to remove the large empty space around the actual images (I made the canvas larger than necessary to let 
                      me move the layers around more freely)
08:34:46 < PovAddict> I saved the image, and when I reopened it, the transparency mask was shifted from its position quite a lot
08:35:03 < boud> hm, that's not good. Which version of krita are you using?
08:35:25 < PovAddict> I think the offset from the correct position is related to how much I cropped
08:35:39 < PovAddict> anyway, I used the move tool to put the transparency mask layer back in place
08:35:41 < PovAddict> saved the image
08:35:43 < PovAddict> reopened it
08:35:47 < PovAddict> and it was out of place again
08:36:13 < PovAddict> krita 2.4.3
08:36:22 < boud> ok, let me try to reproduce
08:37:01 < PovAddict> I'll try tomorrow again, using simpler images (I can't give you my .kra, due to privacy and due to 50MB+)
08:38:09 < boud> yes, I can easily reproduce
08:38:29 < boud> the mask is more to the bottom-right than it should be
08:38:36 < PovAddict> oh perfect
08:39:32 < boud> now I'll check 2.5rc1
08:40:12 < boud> still in 2.5, okay, I'll create a bug report
Comment 1 Halla Rempt 2012-08-01 06:42:53 UTC
Created attachment 72866 [details]
image with mask to play with
Comment 2 Halla Rempt 2012-08-08 18:41:10 UTC
Was already present in 2.4
Comment 3 Dmitry Kazakov 2012-10-26 11:37:19 UTC
Git commit 348ee8b634ffd41bc59997e1dee841d6df2da259 by Dmitry Kazakov.
Committed on 26/10/2012 at 13:23.
Pushed by dkazakov into branch 'master'.

Fixed loading of masks with the offset

That patch introduces the following changes:
1) Removed lazy initialization of masks' selection. Now you always must
   call initSelection after the creation of the mask (probably, we can
   move it into c-tor).
2) KisMask::setSelection must only be used when we need to switch the
   underlying selection explicitly (like, e.g. in
   KisImage::setGlobalSelection). In the rest of the cases you need to
   work with already existent selection.

M  +1    -0    krita/image/kis_image.cc
M  +6    -23   krita/image/kis_mask.cc
M  +3    -0    krita/image/tests/kis_filter_mask_test.cpp
M  +26   -17   krita/image/tests/kis_mask_test.cpp
M  +2    -0    krita/image/tests/kis_transparency_mask_test.cpp
M  +24   -0    krita/sdk/tests/testutil.h
M  +11   -14   krita/ui/kra/kis_kra_load_visitor.cpp
M  +1    -1    krita/ui/kra/kis_kra_load_visitor.h
M  +11   -8    krita/ui/kra/kis_kra_loader.cpp
M  +4    -4    krita/ui/kra/kis_kra_loader.h

http://commits.kde.org/calligra/348ee8b634ffd41bc59997e1dee841d6df2da259
Comment 4 Dmitry Kazakov 2012-10-26 11:37:20 UTC
Git commit 7da5237740f207f41227a5e12dfca246fa37497b by Dmitry Kazakov.
Committed on 26/10/2012 at 13:23.
Pushed by dkazakov into branch 'vector_compositioning_kazakov'.

Fixed loading of masks with the offset

That patch introduces the following changes:
1) Removed lazy initialization of masks' selection. Now you always must
   call initSelection after the creation of the mask (probably, we can
   move it into c-tor).
2) KisMask::setSelection must only be used when we need to switch the
   underlying selection explicitly (like, e.g. in
   KisImage::setGlobalSelection). In the rest of the cases you need to
   work with already existent selection.

M  +1    -0    krita/image/kis_image.cc
M  +6    -23   krita/image/kis_mask.cc
M  +3    -0    krita/image/tests/kis_filter_mask_test.cpp
M  +26   -17   krita/image/tests/kis_mask_test.cpp
M  +2    -0    krita/image/tests/kis_transparency_mask_test.cpp
M  +24   -0    krita/sdk/tests/testutil.h
M  +11   -14   krita/ui/kra/kis_kra_load_visitor.cpp
M  +1    -1    krita/ui/kra/kis_kra_load_visitor.h
M  +11   -8    krita/ui/kra/kis_kra_loader.cpp
M  +4    -4    krita/ui/kra/kis_kra_loader.h

http://commits.kde.org/calligra/7da5237740f207f41227a5e12dfca246fa37497b
Comment 5 Jarosław Staniek 2012-10-31 11:35:10 UTC
Git commit 992c5c23ea09b525dd90e1aed1e4ada7406d75dd by Jaroslaw Staniek, on behalf of Dmitry Kazakov.
Committed on 26/10/2012 at 13:23.
Pushed by staniek into branch 'kexi-altertable-staniek'.

Fixed loading of masks with the offset

That patch introduces the following changes:
1) Removed lazy initialization of masks' selection. Now you always must
   call initSelection after the creation of the mask (probably, we can
   move it into c-tor).
2) KisMask::setSelection must only be used when we need to switch the
   underlying selection explicitly (like, e.g. in
   KisImage::setGlobalSelection). In the rest of the cases you need to
   work with already existent selection.

M  +1    -0    krita/image/kis_image.cc
M  +6    -23   krita/image/kis_mask.cc
M  +3    -0    krita/image/tests/kis_filter_mask_test.cpp
M  +26   -17   krita/image/tests/kis_mask_test.cpp
M  +2    -0    krita/image/tests/kis_transparency_mask_test.cpp
M  +24   -0    krita/sdk/tests/testutil.h
M  +11   -14   krita/ui/kra/kis_kra_load_visitor.cpp
M  +1    -1    krita/ui/kra/kis_kra_load_visitor.h
M  +11   -8    krita/ui/kra/kis_kra_loader.cpp
M  +4    -4    krita/ui/kra/kis_kra_loader.h

http://commits.kde.org/calligra/992c5c23ea09b525dd90e1aed1e4ada7406d75dd