Bug 389905

Summary: Merging two shape layers after image rescaling creates untransformed shapes
Product: [Applications] krita Reporter: Dmitry Kazakov <dimula73>
Component: Layers/VectorAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Dmitry Kazakov 2018-02-05 08:07:48 UTC
1) Create an image with two shape layers
2) Image->Scale Image and grow it twice
3) Merge Down the two layers -> the shapes return to their untransformed state
Comment 1 Dmitry Kazakov 2018-02-05 21:35:37 UTC
Git commit f2ad5ab4cadf5821dd6443e6b9ccd915edf3c0cb by Dmitry Kazakov.
Committed on 05/02/2018 at 21:34.
Pushed by dkazakov into branch 'master'.

Fix merging of two shape layers (also after scaling)

1) Implement correct reordering of the shapes according to zIndex
   (see KoShapeReorderCommand::mergeDownShapes()). Added
   homogenizeZIndexes() function, that can be reused in other cases
   for linearizing the indexes

2) KisShapeLayer should be linked to its own KoShapeManager, otherwise
   transformations of the layer will not issue updates.

3) KisShapeLayerCanvas::updateCanvas() should use toAlignedRect() to
   handle antialiasing correctly.

The patch also adds a unittest for checking all these bugs :)

M  +101  -3    libs/flake/commands/KoShapeReorderCommand.cpp
M  +17   -0    libs/flake/commands/KoShapeReorderCommand.h
M  +16   -6    libs/flake/commands/KoShapeShadowCommand.cpp
M  +22   -22   libs/image/tests/kis_image_test.cpp
M  +4    -4    libs/image/tests/kis_transform_mask_test.cpp
M  +24   -2    libs/ui/flake/kis_shape_layer.cc
M  +10   -2    libs/ui/flake/kis_shape_layer_canvas.cpp
M  +1    -0    libs/ui/tests/CMakeLists.txt
A  +-    --    libs/ui/tests/data/shape_layer_test/merge_down_00_initial_layer_update.png
A  +-    --    libs/ui/tests/data/shape_layer_test/merge_down_02_after_merge_down.png
A  +-    --    libs/ui/tests/data/shape_layer_test/scale_and_merge_down_00_initial_layer_update.png
A  +-    --    libs/ui/tests/data/shape_layer_test/scale_and_merge_down_01_after_scale_down.png
A  +-    --    libs/ui/tests/data/shape_layer_test/scale_and_merge_down_02_after_merge_down.png
M  +2    -2    libs/ui/tests/kis_file_layer_test.cpp
M  +2    -2    libs/ui/tests/kis_node_juggler_compressed_test.cpp
M  +2    -2    libs/ui/tests/kis_shape_commands_test.cpp
A  +243  -0    libs/ui/tests/kis_shape_layer_test.cpp     [License: GPL (v2+)]
A  +36   -0    libs/ui/tests/kis_shape_layer_test.h     [License: GPL (v2+)]
M  +4    -4    plugins/impex/libkra/tests/kis_kra_saver_test.cpp
M  +25   -8    sdk/tests/testutil.h

https://commits.kde.org/krita/f2ad5ab4cadf5821dd6443e6b9ccd915edf3c0cb