"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/impex/exr/exr_converter.cc" between
krita-5.1.3.tar.xz and krita-5.1.4.tar.xz

About: Krita is a painting program offering art tools for everyone (concept art, texture and matte painters, illustrations and comics).

exr_converter.cc  (krita-5.1.3.tar.xz):exr_converter.cc  (krita-5.1.4.tar.xz)
skipping to change at line 429 skipping to change at line 429
void EXRConverter::Private::decodeData1(Imf::InputFile& file, ExrPaintLayerInfo& info, KisPaintLayerSP layer, int width, int xstart, int ystart, int height, Imf ::PixelType ptype) void EXRConverter::Private::decodeData1(Imf::InputFile& file, ExrPaintLayerInfo& info, KisPaintLayerSP layer, int width, int xstart, int ystart, int height, Imf ::PixelType ptype)
{ {
typedef typename GrayPixelWrapper<_T_>::channel_type channel_type; typedef typename GrayPixelWrapper<_T_>::channel_type channel_type;
typedef typename GrayPixelWrapper<_T_>::pixel_type pixel_type; typedef typename GrayPixelWrapper<_T_>::pixel_type pixel_type;
KIS_ASSERT_RECOVER_RETURN( KIS_ASSERT_RECOVER_RETURN(
layer->paintDevice()->colorSpace()->colorModelId() == GrayAColor ModelID); layer->paintDevice()->colorSpace()->colorModelId() == GrayAColor ModelID);
QVector<pixel_type> pixels(width * height); QVector<pixel_type> pixels(width * height);
Q_ASSERT(info.channelMap.contains("G")); Q_ASSERT(info.channelMap.contains("Y"));
dbgFile << "G -> " << info.channelMap["G"]; dbgFile << "Gray -> " << info.channelMap["Y"];
bool hasAlpha = info.channelMap.contains("A"); bool hasAlpha = info.channelMap.contains("A");
dbgFile << "Has Alpha:" << hasAlpha; dbgFile << "Has Alpha:" << hasAlpha;
Imf::FrameBuffer frameBuffer; Imf::FrameBuffer frameBuffer;
pixel_type* frameBufferData = (pixels.data()) - xstart - ystart * width; pixel_type* frameBufferData = (pixels.data()) - xstart - ystart * width;
frameBuffer.insert(info.channelMap["G"].toLatin1().constData(), frameBuffer.insert(
Imf::Slice(ptype, (char *) &frameBufferData->gray, info.channelMap["Y"].toLatin1().constData(),
sizeof(pixel_type) * 1, Imf::Slice(ptype, (char *)&frameBufferData->gray, sizeof(pixel_type) * 1
sizeof(pixel_type) * width)); , sizeof(pixel_type) * width));
if (hasAlpha) { if (hasAlpha) {
frameBuffer.insert(info.channelMap["A"].toLatin1().constData(), frameBuffer.insert(info.channelMap["A"].toLatin1().constData(),
Imf::Slice(ptype, (char *) &frameBufferData->alpha, Imf::Slice(ptype, (char *) &frameBufferData->alpha,
sizeof(pixel_type) * 1, sizeof(pixel_type) * 1,
sizeof(pixel_type) * width)); sizeof(pixel_type) * width));
} }
file.setFrameBuffer(frameBuffer); file.setFrameBuffer(frameBuffer);
file.readPixels(ystart, height + ystart - 1); file.readPixels(ystart, height + ystart - 1);
skipping to change at line 686 skipping to change at line 685
dbgFile << "File has" << informationObjects.size() << "layer(s)"; dbgFile << "File has" << informationObjects.size() << "layer(s)";
// Set the colorspaces // Set the colorspaces
for (int i = 0; i < informationObjects.size(); ++i) { for (int i = 0; i < informationObjects.size(); ++i) {
ExrPaintLayerInfo& info = informationObjects[i]; ExrPaintLayerInfo& info = informationObjects[i];
QString modelId; QString modelId;
if (info.channelMap.size() == 1) { if (info.channelMap.size() == 1) {
modelId = GrayAColorModelID.id(); modelId = GrayAColorModelID.id();
QString key = info.channelMap.begin().key(); QString key = info.channelMap.begin().key();
if (key != "G") { if (key != "Y") {
info.remappedChannels.push_back(ExrPaintLayerInfo::Remap(key info.remappedChannels.push_back(ExrPaintLayerInfo::Remap(key
, "G")); , "Y"));
QString channel = info.channelMap.begin().value(); QString channel = info.channelMap.begin().value();
info.channelMap.clear(); info.channelMap.clear();
info.channelMap["G"] = channel; info.channelMap["Y"] = channel;
} }
} }
else if (info.channelMap.size() == 2) { else if (info.channelMap.size() == 2) {
modelId = GrayAColorModelID.id(); modelId = GrayAColorModelID.id();
QMap<QString,QString>::const_iterator it = info.channelMap.const Begin(); QMap<QString,QString>::const_iterator it = info.channelMap.const Begin();
QMap<QString,QString>::const_iterator end = info.channelMap.cons tEnd(); QMap<QString,QString>::const_iterator end = info.channelMap.cons tEnd();
QString failingChannelKey; QString failingChannelKey;
for (; it != end; ++it) { for (; it != end; ++it) {
if (it.key() != "G" && it.key() != "A") { // BUG: 461975
if (it.key() != "A") {
failingChannelKey = it.key(); failingChannelKey = it.key();
break; break;
} }
} }
info.remappedChannels.push_back( info.remappedChannels.push_back(ExrPaintLayerInfo::Remap(failing
ExrPaintLayerInfo::Remap(failingChannelKey, "G")); ChannelKey, "Y"));
QString failingChannelValue = info.channelMap[failingChannelKey] ; QString failingChannelValue = info.channelMap[failingChannelKey] ;
info.channelMap.remove(failingChannelKey); info.channelMap.remove(failingChannelKey);
info.channelMap["G"] = failingChannelValue; info.channelMap["Y"] = failingChannelValue;
} }
else if (info.channelMap.size() == 3 || info.channelMap.size() == 4) { else if (info.channelMap.size() == 3 || info.channelMap.size() == 4) {
if (info.channelMap.contains("R") && info.channelMap.contains("G ") && info.channelMap.contains("B")) { if (info.channelMap.contains("R") && info.channelMap.contains("G ") && info.channelMap.contains("B")) {
modelId = RGBAColorModelID.id(); modelId = RGBAColorModelID.id();
} }
else if (info.channelMap.contains("X") && info.channelMap.contai ns("Y") && info.channelMap.contains("Z")) { else if (info.channelMap.contains("X") && info.channelMap.contai ns("Y") && info.channelMap.contains("Z")) {
modelId = XYZAColorModelID.id(); modelId = XYZAColorModelID.id();
QMap<QString, QString> newChannelMap; QMap<QString, QString> newChannelMap;
if (info.channelMap.contains("W")) { if (info.channelMap.contains("W")) {
skipping to change at line 1102 skipping to change at line 1100
ExrPaintLayerSaveInfo info; ExrPaintLayerSaveInfo info;
info.layer = layer; info.layer = layer;
info.layerDevice = wrapLayerDevice(layer->paintDevice()); info.layerDevice = wrapLayerDevice(layer->paintDevice());
Imf::PixelType pixelType = Imf::NUM_PIXELTYPES; Imf::PixelType pixelType = Imf::NUM_PIXELTYPES;
if (info.layerDevice->colorSpace()->colorDepthId() == Float16BitsColorDepthI D) { if (info.layerDevice->colorSpace()->colorDepthId() == Float16BitsColorDepthI D) {
pixelType = Imf::HALF; pixelType = Imf::HALF;
} }
else if (info.layerDevice->colorSpace()->colorDepthId() == Float32BitsColorD epthID) { else if (info.layerDevice->colorSpace()->colorDepthId() == Float32BitsColorD epthID) {
pixelType = Imf::FLOAT; pixelType = Imf::FLOAT;
} }
header.channels().insert("R", Imf::Channel(pixelType));
header.channels().insert("G", Imf::Channel(pixelType));
header.channels().insert("B", Imf::Channel(pixelType));
header.channels().insert("A", Imf::Channel(pixelType));
info.channels.push_back("R");
info.channels.push_back("G");
info.channels.push_back("B");
info.channels.push_back("A");
info.pixelType = pixelType; info.pixelType = pixelType;
if (info.layerDevice->colorSpace()->colorModelId() == RGBAColorModelID) {
header.channels().insert("R", Imf::Channel(pixelType));
header.channels().insert("G", Imf::Channel(pixelType));
header.channels().insert("B", Imf::Channel(pixelType));
header.channels().insert("A", Imf::Channel(pixelType));
info.channels.push_back("R");
info.channels.push_back("G");
info.channels.push_back("B");
info.channels.push_back("A");
} else if (info.layerDevice->colorSpace()->colorModelId() == GrayAColorModel
ID) {
header.channels().insert("Y", Imf::Channel(pixelType));
header.channels().insert("A", Imf::Channel(pixelType));
info.channels.push_back("Y");
info.channels.push_back("A");
} else if (info.layerDevice->colorSpace()->colorModelId() == XYZAColorModelI
D) {
header.channels().insert("X", Imf::Channel(pixelType));
header.channels().insert("Y", Imf::Channel(pixelType));
header.channels().insert("Z", Imf::Channel(pixelType));
header.channels().insert("A", Imf::Channel(pixelType));
info.channels.push_back("X");
info.channels.push_back("Y");
info.channels.push_back("Z");
info.channels.push_back("A");
}
// Open file for writing // Open file for writing
try { try {
Imf::OutputFile file(filename.toUtf8(), header); Imf::OutputFile file(filename.toUtf8(), header);
QList<ExrPaintLayerSaveInfo> informationObjects; QList<ExrPaintLayerSaveInfo> informationObjects;
informationObjects.push_back(info); informationObjects.push_back(info);
encodeData(file, informationObjects, width, height); encodeData(file, informationObjects, width, height);
return ImportExportCodes::OK; return ImportExportCodes::OK;
} catch(std::exception &e) { } catch(std::exception &e) {
skipping to change at line 1227 skipping to change at line 1245
} }
else { else {
if (info.layerDevice->colorSpace()->colorModelId() == RGBAColorM odelID) { if (info.layerDevice->colorSpace()->colorModelId() == RGBAColorM odelID) {
info.channels.push_back(info.name + remap(current2original, "R")); info.channels.push_back(info.name + remap(current2original, "R"));
info.channels.push_back(info.name + remap(current2original, "G")); info.channels.push_back(info.name + remap(current2original, "G"));
info.channels.push_back(info.name + remap(current2original, "B")); info.channels.push_back(info.name + remap(current2original, "B"));
info.channels.push_back(info.name + remap(current2original, "A")); info.channels.push_back(info.name + remap(current2original, "A"));
} }
else if (info.layerDevice->colorSpace()->colorModelId() == GrayA ColorModelID) { else if (info.layerDevice->colorSpace()->colorModelId() == GrayA ColorModelID) {
info.channels.push_back(info.name + remap(current2original, "G")); info.channels.push_back(info.name + remap(current2original, "Y"));
info.channels.push_back(info.name + remap(current2original, "A")); info.channels.push_back(info.name + remap(current2original, "A"));
} } else if (info.layerDevice->colorSpace()->colorModelId() == XYZ
else if (info.layerDevice->colorSpace()->colorModelId() == GrayC AColorModelID) {
olorModelID) {
info.channels.push_back(info.name + remap(current2original,
"G"));
}
else if (info.layerDevice->colorSpace()->colorModelId() == XYZAC
olorModelID) {
info.channels.push_back(info.name + remap(current2original, "X")); info.channels.push_back(info.name + remap(current2original, "X"));
info.channels.push_back(info.name + remap(current2original, "Y")); info.channels.push_back(info.name + remap(current2original, "Y"));
info.channels.push_back(info.name + remap(current2original, "Z")); info.channels.push_back(info.name + remap(current2original, "Z"));
info.channels.push_back(info.name + remap(current2original, "A")); info.channels.push_back(info.name + remap(current2original, "A"));
} }
} }
if (info.layerDevice->colorSpace()->colorDepthId() == Float16BitsCol orDepthID) { if (info.layerDevice->colorSpace()->colorDepthId() == Float16BitsCol orDepthID) {
info.pixelType = Imf::HALF; info.pixelType = Imf::HALF;
} }
else if (info.layerDevice->colorSpace()->colorDepthId() == Float32Bi tsColorDepthID) { else if (info.layerDevice->colorSpace()->colorDepthId() == Float32Bi tsColorDepthID) {
info.pixelType = Imf::FLOAT; info.pixelType = Imf::FLOAT;
} }
else { else {
info.pixelType = Imf::NUM_PIXELTYPES; info.pixelType = Imf::NUM_PIXELTYPES;
 End of changes. 12 change blocks. 
34 lines changed or deleted 49 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)