Bug 408936 - Vector objects fail to render after loading on large files
Summary: Vector objects fail to render after loading on large files
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layers/Vector (show other bugs)
Version: 4.2.1
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-20 03:11 UTC by rchrkbkcdd
Modified: 2019-10-09 08:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rchrkbkcdd 2019-06-20 03:11:56 UTC
SUMMARY
In my work I commonly have to draw on files that are roughly 2000 x 40,000px in size. When saving files and coming back to them I will notice that some vector objects fail to load, meaning that they are "invisible". If you click on an "invisible" object and drag it to a new location it will appear again like normal. I noticed that this only happens towards the bottom of the file, around past 20,000 px down. Usually above that in the top half of the image the objects load just fine without issues.

STEPS TO REPRODUCE
1. Open a large file size; (Ex. 2000 x 40,000px)
2. Create a Vector Layer and put in Objects throughout the file
(In my line of work this is commonly "Text")
3. Save File, then reload.

OBSERVED RESULT
Vector objects at a certain point are invisible upon reopening the file.

EXPECTED RESULT
Vector objects able to be seen.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Halla Rempt 2019-06-20 12:52:57 UTC
Hi,

Thanks for your report. I can easily confirm the issue.
Comment 2 vanyossi 2019-07-22 19:26:01 UTC
as note to myself. it stops rendering after pixel 32768, which coincidentally is max limit of a short in C++.
Comment 3 Halla Rempt 2019-07-23 09:28:17 UTC
This is actually a limit in qpainter/qimage api: see for instance https://stackoverflow.com/questions/7080052/qimage-qpixmap-size-limitations.

To avoid this we should implement rendering to tiles instead of one big QImage in KisShapeLayerCanvas. This is quite a job, but not impossible. An impossible but interesting alternative would be to implement a QPainterEngine that works directly on a KisPaintDevice.
Comment 4 vanyossi 2019-07-24 04:35:42 UTC
Proposed fix https://invent.kde.org/kde/krita/merge_requests/74
Comment 5 vanyossi 2019-10-08 03:09:00 UTC
Git commit 909348366cad0ee3d4facc82b7ffb0da147437ea by Ivan Yossi.
Committed on 08/10/2019 at 03:07.
Pushed by ivany into branch 'master'.

Render maxSize image tiles for vector repaints

Paint the image in tiled chunks of 256x256 Qrects, this makes it possible to render vector shapes on images
bigger than QImage limits

M  +29   -17   libs/ui/flake/kis_shape_layer_canvas.cpp

https://invent.kde.org/kde/krita/commit/909348366cad0ee3d4facc82b7ffb0da147437ea
Comment 6 Halla Rempt 2019-10-09 08:40:58 UTC
Git commit 5376c52b928e6a3d5a7007c9304c4e32e5d1b167 by Boudewijn Rempt, on behalf of Ivan Yossi.
Committed on 09/10/2019 at 08:40.
Pushed by rempt into branch 'krita/4.2'.

Render maxSize image tiles for vector repaints

Paint the image in tiled chunks of 256x256 Qrects, this makes it possible to render vector shapes on images
bigger than QImage limits
(cherry picked from commit 909348366cad0ee3d4facc82b7ffb0da147437ea)

M  +29   -17   libs/ui/flake/kis_shape_layer_canvas.cpp

https://invent.kde.org/kde/krita/commit/5376c52b928e6a3d5a7007c9304c4e32e5d1b167