Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Make animation renderer use new png-with-cicp for HDR.

Wolthera van Hövell tot Westerflierea164574fabe
diff --git a/libs/ui/animation/KisDlgAnimationRenderer.cpp b/libs/ui/animation/KisDlgAnimationRenderer.cpp
index a17859b46a..fbeea4b582 100644
--- a/libs/ui/animation/KisDlgAnimationRenderer.cpp
+++ b/libs/ui/animation/KisDlgAnimationRenderer.cpp
@@ -1,3 +1,4 @@
+
/*
* SPDX-FileCopyrightText: 2016 Boudewijn Rempt <[email protected]>
*
@@ -342,7 +343,7 @@ void KisDlgAnimationRenderer::initializeRenderSettings(const KisDocument &doc, c
{
KisPropertiesConfigurationSP settings = loadLastConfiguration("img_sequence/" + lastUsedOptions.frameMimeType);
- m_wantsRenderWithHDR = settings->getPropertyLazy("saveAsHDR", m_wantsRenderWithHDR);
+ m_wantsRenderWithHDR = getPngHdr(settings, m_wantsRenderWithHDR);
}
m_page->ffmpegLocation->setFileName(likelyFFmpegPath);
@@ -857,7 +858,7 @@ void KisDlgAnimationRenderer::sequenceMimeTypeOptionsClicked()
//Important -- m_useHDR allows the synchronization of both the video and image render settings.
#ifndef Q_OS_ANDROID
if(imageMimeSupportsHDR(mimetype)) {
- exportConfig->setProperty("saveAsHDR", m_wantsRenderWithHDR);
+ setPngHdr(exportConfig, m_wantsRenderWithHDR);
if (m_wantsRenderWithHDR) {
exportConfig->setProperty("forceSRGB", false);
}
@@ -870,7 +871,7 @@ void KisDlgAnimationRenderer::sequenceMimeTypeOptionsClicked()
dlg.setButtons(KoDialog::Ok | KoDialog::Cancel);
if (dlg.exec() == QDialog::Accepted) {
#ifndef Q_OS_ANDROID
- m_wantsRenderWithHDR = frameExportConfigWidget->configuration()->getPropertyLazy("saveAsHDR", false);
+ m_wantsRenderWithHDR = getPngHdr(frameExportConfigWidget->configuration(), false);
#endif
saveLastUsedConfiguration("img_sequence/" + mimetype, frameExportConfigWidget->configuration());
}
@@ -949,7 +950,7 @@ KisAnimationRenderingOptions KisDlgAnimationRenderer::getEncoderOptions() const
if (forceNecessaryHDRSettings) {
KIS_SAFE_ASSERT_RECOVER_NOOP(options.frameMimeType == "image/png");
cfg->setProperty("forceSRGB", false);
- cfg->setProperty("saveAsHDR", true);
+ setPngHdr(cfg);
}
#endif
@@ -1042,6 +1043,23 @@ void KisDlgAnimationRenderer::slotDialogAccepted()
m_image->animationInterface()->setExportInitialFrameNumber(options.sequenceStart);
}
+void KisDlgAnimationRenderer::setPngHdr(KisPropertiesConfigurationSP cfg, bool enable)
+{
+ cfg->setProperty("storeColorSpaceInfo", enable);
+ cfg->setProperty("writeCicpIfPossible", enable);
+ if (enable) {
+ cfg->setProperty("storeExtraColorChunks", false);
+ cfg->setProperty("floatingPointConversionOption", "Rec2100PQ");
+ }
+}
+
+bool KisDlgAnimationRenderer::getPngHdr(KisPropertiesConfigurationSP cfg, bool wantsRenderWithHdr)
+{
+ return cfg->getPropertyLazy("storeColorSpaceInfo", wantsRenderWithHdr)
+ && cfg->getPropertyLazy("writeCicpIfPossible", wantsRenderWithHdr)
+ && (cfg->getPropertyLazy("floatingPointConversionOption", wantsRenderWithHdr? "Rec2100PQ": "KeepSame") == "Rec2100PQ");
+}
+
void KisDlgAnimationRenderer::slotExportTypeChanged()
{
setUpdatesEnabled(false);
diff --git a/libs/ui/animation/KisDlgAnimationRenderer.h b/libs/ui/animation/KisDlgAnimationRenderer.h
index c03d271a05..418591ea2a 100644
--- a/libs/ui/animation/KisDlgAnimationRenderer.h
+++ b/libs/ui/animation/KisDlgAnimationRenderer.h
@@ -74,6 +74,9 @@ private Q_SLOTS:
void slotCheckWarnings();
+ static void setPngHdr(KisPropertiesConfigurationSP cfg, bool enable = true);
+ static bool getPngHdr(KisPropertiesConfigurationSP cfg, bool wantsRenderWithHdr);
+
protected Q_SLOTS:
#ifndef Q_OS_ANDROID
void slotButtonClicked(int button) override;