Don't return XYZ for sRGB (#3691)

Also fix length of `ProfileContent` to match the old implementation.
This commit is contained in:
Flössie 2017-03-19 11:18:13 +01:00
parent 99f0d723b5
commit 5632c787a3
3 changed files with 14 additions and 12 deletions

View File

@ -1,12 +1,12 @@
/* /*
* This file is part of RawTherapee. * This file is part of RawTherapee.
* *
* Copyright(c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
* *
* RawTherapee is free software: you can redistribute it and/or modify * RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
*(at your option) any later version. * (at your option) any later version.
* *
* RawTherapee is distributed in the hope that it will be useful, * RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -223,7 +223,7 @@ rtengine::ProfileContent::ProfileContent(const Glib::ustring& fileName)
d[length] = 0; d[length] = 0;
fclose(f); fclose(f);
data.assign(d, length + 1); data.assign(d, length);
delete[] d; delete[] d;
} }
@ -236,7 +236,7 @@ rtengine::ProfileContent::ProfileContent(cmsHPROFILE hProfile)
if (bytesNeeded > 0) { if (bytesNeeded > 0) {
char* d = new char[bytesNeeded + 1]; char* d = new char[bytesNeeded + 1];
cmsSaveProfileToMem(hProfile, d, &bytesNeeded); cmsSaveProfileToMem(hProfile, d, &bytesNeeded);
data.assign(d, bytesNeeded + 1); data.assign(d, bytesNeeded);
delete[] d; delete[] d;
} }
} }
@ -247,7 +247,7 @@ cmsHPROFILE rtengine::ProfileContent::toProfile() const
return return
!data.empty() !data.empty()
? cmsOpenProfileFromMem(data.data(), data.size()) ? cmsOpenProfileFromMem(data.c_str(), data.size())
: nullptr; : nullptr;
} }
@ -690,7 +690,7 @@ cmsHPROFILE rtengine::ICCStore::getXYZProfile() const
cmsHPROFILE rtengine::ICCStore::getsRGBProfile() const cmsHPROFILE rtengine::ICCStore::getsRGBProfile() const
{ {
return implementation->getXYZProfile(); return implementation->getsRGBProfile();
} }
std::vector<Glib::ustring> rtengine::ICCStore::getProfiles(ProfileType type) const std::vector<Glib::ustring> rtengine::ICCStore::getProfiles(ProfileType type) const
@ -1025,7 +1025,8 @@ cmsHPROFILE rtengine::ICCStore::createFromMatrix(const double matrix[3][3], bool
return p; return p;
} }
cmsHPROFILE rtengine::ICCStore::createGammaProfile(const procparams::ColorManagementParams &icm, GammaValues &ga) { cmsHPROFILE rtengine::ICCStore::createGammaProfile(const procparams::ColorManagementParams &icm, GammaValues &ga)
{
float p[6]; //primaries float p[6]; //primaries
ga[6] = 0.0; ga[6] = 0.0;
@ -1121,7 +1122,8 @@ cmsHPROFILE rtengine::ICCStore::createGammaProfile(const procparams::ColorManage
} }
// WARNING: the caller must lock lcmsMutex // WARNING: the caller must lock lcmsMutex
cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams::ColorManagementParams &icm, GammaValues &ga) { cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams::ColorManagementParams &icm, GammaValues &ga)
{
bool pro = false; bool pro = false;
Glib::ustring outProfile; Glib::ustring outProfile;
cmsHPROFILE outputProfile = nullptr; cmsHPROFILE outputProfile = nullptr;

View File

@ -1,12 +1,12 @@
/* /*
* This file is part of RawTherapee. * This file is part of RawTherapee.
* *
* Copyright(c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
* *
* RawTherapee is free software: you can redistribute it and/or modify * RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
*(at your option) any later version. * (at your option) any later version.
* *
* RawTherapee is distributed in the hope that it will be useful, * RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of

View File

@ -1222,7 +1222,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
if (!useLCMS) { if (!useLCMS) {
// use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generated by lab2rgb16 w/ gamma // use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generated by lab2rgb16 w/ gamma
ProfileContent pc(jprof); ProfileContent pc(jprof);
readyImg->setOutputProfile(pc.getData().data(), pc.getData().size()); readyImg->setOutputProfile(pc.getData().c_str(), pc.getData().size());
} }
} else { } else {
// use the selected output profile if present, otherwise use LCMS2 profile generate by lab2rgb16 w/ gamma // use the selected output profile if present, otherwise use LCMS2 profile generate by lab2rgb16 w/ gamma
@ -1242,7 +1242,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
} }
ProfileContent pc = ICCStore::getInstance()->getContent (params.icm.output); ProfileContent pc = ICCStore::getInstance()->getContent (params.icm.output);
readyImg->setOutputProfile(pc.getData().data(), pc.getData().size()); readyImg->setOutputProfile(pc.getData().c_str(), pc.getData().size());
} }
} else { } else {
// No ICM // No ICM