Commit 61b01b8c authored by Dmitry Kazakov's avatar Dmitry Kazakov Committed by Ashwin Dhakaita

Fix exporting animation frames into EXR format

The patch fixes two problems:

1) DlgAnimationRenderer didn't initialize frames' mimetype correctly,
   so exporting always happened into PNG format.

2) DlgAnimationRenderer should correctly initialize saving format
   settings from the default cfg.exportConfiguration(). Using the
   same settings for both, animation rendering and normal image save
   is a disputable approach, but that  is how we do it for ages.

3) EXRConverter shouldn't call any blocking functions on the image
   (and shouldn't change the state of the image as well). So it should
   convert non-16f/32f layers on the fly.

BUG:406830
parent a00e198d
......@@ -1087,6 +1087,30 @@ KisPaintDeviceSP wrapLayerDevice(KisPaintDeviceSP device)
return device;
}
KisPaintDeviceSP wrapLayerDevice(KisPaintDeviceSP device)
{
const KoColorSpace *cs = device->colorSpace();
if (cs->colorDepthId() != Float16BitsColorDepthID && cs->colorDepthId() != Float32BitsColorDepthID) {
cs = KoColorSpaceRegistry::instance()->colorSpace(
cs->colorModelId() == GrayAColorModelID ?
GrayAColorModelID.id() : RGBAColorModelID.id(),
Float16BitsColorDepthID.id());
} else if (cs->colorModelId() != GrayColorModelID &&
cs->colorModelId() != RGBAColorModelID) {
cs = KoColorSpaceRegistry::instance()->colorSpace(
RGBAColorModelID.id(),
cs->colorDepthId().id());
}
if (*cs != *device->colorSpace()) {
device = new KisPaintDevice(*device);
device->convertTo(cs);
}
return device;
}
KisImportExportErrorCode EXRConverter::buildFile(const QString &filename, KisPaintLayerSP layer)
{
KIS_ASSERT_RECOVER_RETURN_VALUE(layer, ImportExportCodes::InternalError);
......@@ -1103,6 +1127,7 @@ KisImportExportErrorCode EXRConverter::buildFile(const QString &filename, KisPai
ExrPaintLayerSaveInfo info;
info.layer = layer;
info.layerDevice = wrapLayerDevice(layer->paintDevice());
Imf::PixelType pixelType = Imf::NUM_PIXELTYPES;
if (info.layerDevice->colorSpace()->colorDepthId() == Float16BitsColorDepthID) {
pixelType = Imf::HALF;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment