Skip to content

Recorder: add ability to record other color modes and depth

This MR proposes to make Recorder Docker be able to record other than 8-bpc RGBA documents.

I feel it's currently quite limiting for a feature.. (eg. I myself often works with 16-bpc depth documents, and sometimes want to record it too with Krita's recorder docker)

The way I did it is just disabling the canvas color profile checks, and then creating a detached, intermediate paint device that can be converted to 8-bpc sRGB only when needed. This way the original document is always preserved and the output images are properly converted into sRGB. However, maybe the performance still need to be tested further, since there are extra profile checks, paint device cloning and conversion happening.. it is possible to just simply comparing KoColorSpace instances for profile checking, but that comes with a risk that other sRGB profiles will also get converted.

Edit:
Some quick performance testing with QTimerElapsed on my machine (Win10, i7 12700) during the whole captureImage() call, with 4K image (3840x2160):

  • Master (3d0a8b0c): 4-8ms
  • MR, 8-bpc sRGB (no conversion): 6-10ms
  • MR, 8-bpc non-sRGB (conversion): 120-150ms
  • MR, 16-bpc non-sRGB (conversion): 120-150ms

...that's even slower than the capture interval slider can offer (100ms)...

This patch also fixes a possible exploit/bug to trick the current Recorder Docker to record other than 8-bit RGBA documents by doing the following:

  • Open Recorder Docker
  • Create 8-bit RGBA document
  • Record button on docker is enabled
  • Convert image color space to unsupported space (eg. 16-bpc CMYKA)
  • Notice that record button on docker still active (should be disabled)

At this moment if we press record, the recording will continue but will output garbled images like this:

Original Recording
orig record

With this patch, we can freely choose any color model / depth and can record it properly.

Will possibly close BUG: 468136

Test Plan

  • Build Krita
  • Try to record a progress with Recorder Docker, presumably with other than 8-bpc sRGB space.

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 Rasyuqa A H (Kampidh)

Merge request reports