Summary: | Enhancements in Reference tool | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | Dmitrii Utkin <loentar> |
Component: | Usability | Assignee: | Krita Bugs <krita-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | halla |
Priority: | NOR | ||
Version: | git master (please specify the git hash!) | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Dmitrii Utkin
2019-06-08 06:08:03 UTC
Also I found that "paste image" tool decodes image ineffectively - it decodes all supported variants and then chose one by the priority. In my test it was decoding 4 times and Krita freezes for 6 seconds.. I'd like to optimize it too by: 1) querying the clipboard image, return it in case of success 2) else traverse the supported mime-types in *order of priority* and try to decode the image, return it in case of success In addition to 5) there is a KisClipboard::clipboardDataChanged() slot which freezes Krita for few seconds when you copy a large image to clipboard and just switch to Krita/create new image. The way of detecting "is there an image" is unreliable too. "cb->image()" just decodes (and freezes Krita) the main image without respecting the multi-mime-type images. There should be a way to detect clipboard image data without full reading of the image. Maybe QImageReader or QImageIOHandler is the way to go. For me this piece of code looks strange: if (cb->mimeData()->hasImage()) { QImage qimage = cb->image(); if (!qimage.isNull()) m_hasClip = true; const QMimeData *cbData = cb->mimeData(); QByteArray mimeType("application/x-krita-selection"); if (cbData && cbData->hasFormat(mimeType)) m_hasClip = true; } I think it may be rewritten like this without losing anything (in exception of freeze): if (cb->mimeData()->hasImage()) { m_hasClip = true; } For now I just leave it as is, because it needs more testing. Maybe will re-create it as a new bug. Ha, that was merged, so we can close this bug :-) Thanks for the patch! |