Bug 263170

Summary: transform tool makes QImage copy of layer
Product: [Applications] krita Reporter: Halla Rempt <halla>
Component: Tools/TransformAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: major CC: dimula73, lukast.dev
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 312189    

Description Halla Rempt 2011-01-14 20:22:16 UTC
In KisToolTransform::initTransform, a number of QImages are created to the size of the current node. These are then scaled. This will cause crashes when the user tries to transform on a big image. Imagine a 10000x10000 image zoomed at 600%...

A good solution would be to use prescaled QImage tiles that get transformed individually (though border artefacts are hard to avoid) where we initially only create tiles for the visible area of the image.
Comment 1 LukasT 2011-09-24 10:40:55 UTC
Maybe we even don't need tiles but keep copy of scaled version of the current node with some hardcoded maximum size.
Comment 2 Dmitry Kazakov 2013-01-16 12:32:48 UTC
Git commit a406f9c7f13318e906c32b3ef8401b21736cc282 by Dmitry Kazakov.
Committed on 16/01/2013 at 06:48.
Pushed by dkazakov into branch 'krita-fixed-transform-kazakov'.

Removed two full-size QImage copies of the selection in the Transform Tool

The two copies of the selection were present: one in image scale, the other
in the viewport scale, that might be really huge.

And all this just for the sake of painting decorations. Now it is
a simle QPainterPath.

M  +49   -40   krita/plugins/tools/tool_transform2/kis_tool_transform.cc
M  +4    -2    krita/plugins/tools/tool_transform2/kis_tool_transform.h
M  +1    -7    krita/plugins/tools/tool_transform2/tool_transform_commands.cc
M  +1    -3    krita/plugins/tools/tool_transform2/tool_transform_commands.h

http://commits.kde.org/calligra/a406f9c7f13318e906c32b3ef8401b21736cc282
Comment 3 Dmitry Kazakov 2013-01-16 12:32:48 UTC
Git commit d86109fcd2f214dddc21e5c2d71f324723885fd6 by Dmitry Kazakov.
Committed on 16/01/2013 at 13:28.
Pushed by dkazakov into branch 'krita-fixed-transform-kazakov'.

Fixed KisToolTransform not to create full-sized QImage copies of the node

Now the size of the QImage is limited by 3000px. If it is less,
the 3000px thumb is upscaled on the fly using QPainter.

There are several things left to be done:

1) Prescale the QImage to the flake size when the scale < 1.0
   (this is a regression of this patch
2) Try to remove all these non-centralized calculations and
   numerous member variables. As much as possible should be done with
   a simple QTransform.

M  +83   -64   krita/plugins/tools/tool_transform2/kis_tool_transform.cc
M  +7    -0    krita/plugins/tools/tool_transform2/kis_tool_transform.h
M  +1    -4    krita/plugins/tools/tool_transform2/tool_transform_args.cc
M  +1    -8    krita/plugins/tools/tool_transform2/tool_transform_args.h

http://commits.kde.org/calligra/d86109fcd2f214dddc21e5c2d71f324723885fd6
Comment 4 Dmitry Kazakov 2013-01-17 10:28:07 UTC
Git commit d76737f3bf174ca820ac55b7f6aa96fdf65b2279 by Dmitry Kazakov.
Committed on 17/01/2013 at 11:26.
Pushed by dkazakov into branch 'krita-fixed-transform-kazakov'.

Fixed a regression in the Wrap Tool

Restored an optimization that made the preview for the Wrap Tool
work in Flake coordinates when it is a sane thing to do, that is when
the size of the preview in flake coordinates is smaller than the size
of the stored thumbnail. Now we can close the bug about huge images: the
thumbnail can't be more than 2000px anymore.

M  +66   -46   krita/plugins/tools/tool_transform2/kis_tool_transform.cc
M  +2    -1    krita/plugins/tools/tool_transform2/kis_tool_transform.h
M  +1    -7    krita/plugins/tools/tool_transform2/tool_transform_commands.cc
M  +1    -2    krita/plugins/tools/tool_transform2/tool_transform_commands.h

http://commits.kde.org/calligra/d76737f3bf174ca820ac55b7f6aa96fdf65b2279