[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/calligra/2.9] krita/plugins/formats/exr: Fix saving exr images with top-level channels
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2015-09-21 10:15:33
Message-ID: E1Zdy8D-0003xt-Gb () scm ! kde ! org
[Download RAW message or body]

Git commit 9bbfb52dbaf1d13aaa3d3734e042af28a04cd8e6 by Boudewijn Rempt.
Committed on 21/09/2015 at 10:14.
Pushed by rempt into branch 'calligra/2.9'.

Fix saving exr images with top-level channels

We create a layer for the top-level channels with the name
"HDR Layer". On saving, strip that part again, so we round-trip
back to the original channel names.

CCBUG:52734

M  +10   -3    krita/plugins/formats/exr/exr_converter.cc

http://commits.kde.org/calligra/9bbfb52dbaf1d13aaa3d3734e042af28a04cd8e6

diff --git a/krita/plugins/formats/exr/exr_converter.cc b/krita/plugins/formats/exr/exr_converter.cc
index a38e7b7..3a938e1 100644
--- a/krita/plugins/formats/exr/exr_converter.cc
+++ b/krita/plugins/formats/exr/exr_converter.cc
@@ -1155,9 +1155,11 @@ void exrConverter::Private::recBuildPaintLayerSaveInfo(QList<ExrPaintLayerSaveIn
                 // TODO should probably inform that one of the layer cannot be saved.
             }
 
-        } else if (KisGroupLayerSP groupLayer = dynamic_cast<KisGroupLayer*>(node.data())) {
+        }
+        else if (KisGroupLayerSP groupLayer = dynamic_cast<KisGroupLayer*>(node.data())) {
             recBuildPaintLayerSaveInfo(informationObjects, name + groupLayer->name() + '.', groupLayer);
-        } else {
+        }
+        else {
             /**
              * The EXR can store paint and group layers only. The rest will
              * go to /dev/null :(
@@ -1259,7 +1261,12 @@ KisImageBuilder_Result exrConverter::buildFile(const KUrl& uri, KisGroupLayerSP
         if (info.pixelType < Imf::NUM_PIXELTYPES) {
             foreach(const QString& channel, info.channels) {
                 dbgFile << channel << " " << info.pixelType;
-                header.channels().insert(channel.toUtf8().data(), Imf::Channel(info.pixelType));
+                QString s = channel;
+                if (channel.contains(i18n("HDR Layer"))) {
+                    s = channel.mid(channel.indexOf('.') + 1);
+                }
+
+                header.channels().insert(s.toUtf8().data(), Imf::Channel(info.pixelType));
             }
         }
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic