Skip to content

Bugfix: two bugs related to pasting image data into krita, along with some refactoring ( BUG: 475409 )

Simon Ra requested to merge simonra/krita:bug_475409 into master

This fixes "Paste into active layer" with non-krita mime type image sources (which seems to me was completely defunct), and also fixes wonky math around detecting when a pasted image is outside of the bounds of the canvas its being pasted into.

There is also some minor refactoring of the affected code.

Edit: seems like i also inadvertedly fixed a use-after-free and double free combo, heh.

bug link https://bugs.kde.org/show_bug.cgi?id=475409

Test Plan

  1. make a new biggish image A
  2. draw a blob in the top left and bottom right corners of image A
  3. select and copy:
  • the top left blob in image A
  • the bottom right blob in image A
  • both blobs and the space inbetween them
  • both blobs without the space inbetween them
  • any image in another image processing application
  1. create a second image B, much smaller in size
  2. paste:
  • "paste into active layer" on image B
  • regular paste on image B
  1. ensure the paste worked correctly. for 3c and 3d you may not see anything, but the transform should be centered on the image and the too guides visible

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Edited by Simon Ra

Merge request reports