SUMMARY The size of the image saved to the system clipboard can strongly impact the startup time of the New File dialog, even though the user might not necessarily plan to use Create from Clipboard. Not a regression of Krita 5. STEPS TO REPRODUCE 1. Download the source jpeg from https://www.peppercarrot.com/en/viewer/artworks__2020-01-25_cover_book-project_by-David-Revoy.html from the top left. (the file should be 8.3 MB) 2. Open it in Krita. 3. Cut the image with Ctrl + X. 4. Open a New File dialog. OBSERVED RESULT On my computer it takes a couple seconds for the New File dialog to pop up. Confirm the difference by cutting a small stroke. EXPECTED RESULT Startup time of the dialog should be basically instant. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Debian sid KDE Plasma Version: 5.21.5 KDE Frameworks Version: 5.86.0 Qt Version: 5.12.11 (Appimage)
Git commit 4d025b799e644203e1b985439af05be3cff77101 by Halla Rempt. Committed on 12/07/2022 at 12:39. Pushed by rempt into branch 'master'. Only create the clip preview when the image from clip widget is shown M +4 -2 libs/ui/widgets/kis_custom_image_widget.h M +7 -3 libs/ui/widgets/kis_image_from_clipboard_widget.cpp M +4 -1 libs/ui/widgets/kis_image_from_clipboard_widget.h https://invent.kde.org/graphics/krita/commit/4d025b799e644203e1b985439af05be3cff77101
Git commit 3d7b2e017e49276064ceafce7932a72359541aad by Halla Rempt. Committed on 12/07/2022 at 12:40. Pushed by rempt into branch 'krita/5.1'. Only create the clip preview when the image from clip widget is shown (cherry picked from commit c0785aafac25d74465a06ebdfd3ff17832911554) M +4 -2 libs/ui/widgets/kis_custom_image_widget.h M +7 -3 libs/ui/widgets/kis_image_from_clipboard_widget.cpp M +4 -1 libs/ui/widgets/kis_image_from_clipboard_widget.h https://invent.kde.org/graphics/krita/commit/3d7b2e017e49276064ceafce7932a72359541aad
I'm sorry but I think the fix might have made the issue worse for a different case: If I copy the image from the browser instead of from Krita, then I get both the added startup time for both the dialog AND when clicking "Create from Clipboard". Creating the image from clipboard itself will also take a while until I get the prompt for how Krita should read the image from the clipboard. It seems to be fine with the initally reported case of copying from Krita itself.
That's not possible? The clip is only created when the clipboard page is shown.
Okay, even if I completely remove the clipboard widget, having a large image on the clipboard makes the new image dialog take more time to show.
Ah, that was because I copied and pressed ctrl-n before krita was done loading the clip.
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1540
Git commit bdf06f6511a8c29a3988b021cedca0b23a0a74b7 by Halla Rempt. Committed on 12/08/2022 at 05:39. Pushed by rempt into branch 'master'. Only access the clipboard when we really need it * remove two superfluous sig/slot connections in KisClipboard. These QClipboard modes are not relevant for Krita, and were fired together with dataChanged, resulting in clipboardChanged being called three times. * remove the preview() method which was only used by the custom image widget * set the default w/h for the imagefromclipboard widget to 1, so we don't need to retrieve the QImage from the clipboard just to get the actual dimensions * simplify KisClipboard::clipboardDataChanged so it doesn't need to retrieve the qimage from the clipboard. This means that hasClip() can be true because there are images on the qclipboard, so that needs to be tested. M +3 -9 libs/ui/KisMainWindow.cpp M +3 -40 libs/ui/kis_clipboard.cc M +0 -3 libs/ui/kis_clipboard.h M +0 -1 libs/ui/widgets/kis_custom_image_widget.cc M +23 -9 libs/ui/widgets/kis_image_from_clipboard_widget.cpp M +4 -4 libs/ui/widgets/kis_image_from_clipboard_widget.h https://invent.kde.org/graphics/krita/commit/bdf06f6511a8c29a3988b021cedca0b23a0a74b7
Git commit 2b4743edc4c6a8d0a2ad35bfcd270a2c6dcca7e5 by Halla Rempt. Committed on 12/08/2022 at 05:39. Pushed by rempt into branch 'krita/5.1'. Only access the clipboard when we really need it * remove two superfluous sig/slot connections in KisClipboard. These QClipboard modes are not relevant for Krita, and were fired together with dataChanged, resulting in clipboardChanged being called three times. * remove the preview() method which was only used by the custom image widget * set the default w/h for the imagefromclipboard widget to 1, so we don't need to retrieve the QImage from the clipboard just to get the actual dimensions * simplify KisClipboard::clipboardDataChanged so it doesn't need to retrieve the qimage from the clipboard. This means that hasClip() can be true because there are images on the qclipboard, so that needs to be tested. (cherry picked from commit bdf06f6511a8c29a3988b021cedca0b23a0a74b7) M +3 -9 libs/ui/KisMainWindow.cpp M +3 -40 libs/ui/kis_clipboard.cc M +0 -3 libs/ui/kis_clipboard.h M +0 -1 libs/ui/widgets/kis_custom_image_widget.cc M +23 -9 libs/ui/widgets/kis_image_from_clipboard_widget.cpp M +4 -4 libs/ui/widgets/kis_image_from_clipboard_widget.h https://invent.kde.org/graphics/krita/commit/2b4743edc4c6a8d0a2ad35bfcd270a2c6dcca7e5
*** Bug 426734 has been marked as a duplicate of this bug. ***