Skip to content

Fix bug 442127. FileLayer DPI scaling issues.

Fix the DPI scaling issues for File Layers. KisFileLayer uses KisSafeDocumentLoader for loading image data. KisSafeDocumentLoader did not set DPI for loaded images and every file layer was scaled using the default xRes = 1 and yRes = 1.

DPI is taken from QImage which feels hacky and DotsPerMeter functions are not particularly precise.

Test Plan

The bug report has a test project NEW archive which can be used to test the issue. Generally:

  1. Create a file that will be included as a File Layer (any DPI)
  2. Create a file that will include the File Layer with different DPI.

Expected: Image scaled according to the DPI and physical dimensions stay the same.

Result: Image scales correctly only when File Layer image DPI = 72.

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.
Edited by Egor Efimov

Merge request reports