[Calligra] 0120ea7: Fix: painterly colorspace when used with lcms2 but
Cyrille Berger Skott
cberger at cberger.net
Tue Dec 14 10:48:48 CET 2010
Actually I need a review for that patch so that it can goes in branch/2.3 .
The detail is that in lcms2 the srgb profiled is named "sRGB - build-in" and
not "sRGB - build-in (internal)", so we need to use the alias otherwise the
profile is not found. And it leads to bug:259153
On Sunday 12 December 2010, Cyrille Berger wrote:
> commit 0120ea7d1a33fce84f33435e3008804d792347ba
> branch master
> Author: Cyrille Berger <cberger at cberger.net>
> Date: Sun Dec 12 15:57:28 2010 +0100
>
> Fix: painterly colorspace when used with lcms2 but no openctl
>
> diff --git a/libs/pigment/KoColorConversionSystem.cpp
> b/libs/pigment/KoColorConversionSystem.cpp index 7577f4f..6d8baf3 100644
> --- a/libs/pigment/KoColorConversionSystem.cpp
> +++ b/libs/pigment/KoColorConversionSystem.cpp
> @@ -313,10 +313,10 @@ KoColorConversionTransformation*
> KoColorConversionSystem::createTransformationFr
> KoMultipleColorConversionTransformation* mccTransfo = new
> KoMultipleColorConversionTransformation(srcColorSpace, dstColorSpace,
> renderingIntent); transfo = mccTransfo;
> // Get the first intermediary color space
> + dbgPigmentCCS << pathOfNode[ 0 ].first->id() << " to " <<
> pathOfNode[ 1 ].first->id(); const KoColorSpace* intermCS =
> defaultColorSpaceForNode(pathOfNode[1].first);
>
> mccTransfo->appendTransfo(pathOfNode[1].second->createColorTransformation(
> srcColorSpace, intermCS, renderingIntent)); - dbgPigmentCCS <<
> pathOfNode[ 0 ].first->id() << " to " << pathOfNode[ 1 ].first->id(); for
> (int i = 2; i < pathOfNode.size() - 1; i++) {
> dbgPigmentCCS << pathOfNode[ i - 1 ].first->id() << " to " <<
> pathOfNode[ i ].first->id(); const KoColorSpace* intermCS2 =
> defaultColorSpaceForNode(pathOfNode[i].first); diff --git
> a/libs/pigment/KoColorConversionTransformationFactory.cpp
> b/libs/pigment/KoColorConversionTransformationFactory.cpp index
> 5a334e8..f40d40d 100644
> --- a/libs/pigment/KoColorConversionTransformationFactory.cpp
> +++ b/libs/pigment/KoColorConversionTransformationFactory.cpp
> @@ -24,6 +24,7 @@
> #include "KoColorProfile.h"
> #include "KoColorSpace.h"
> #include "DebugPigment.h"
> +#include "KoColorSpaceRegistry.h"
>
> struct KoColorConversionTransformationFactory::Private {
> QString srcModelId;
> @@ -40,8 +41,8 @@
> KoColorConversionTransformationFactory::KoColorConversionTransformationFac
> tory(Q d->srcDepthId = _srcDepthId;
> d->dstModelId = _dstModelId;
> d->dstDepthId = _dstDepthId;
> - d->srcProfile = _srcProfile;
> - d->dstProfile = _dstProfile;
> + d->srcProfile =
> KoColorSpaceRegistry::instance()->profileAlias(_srcProfile); +
> d->dstProfile =
> KoColorSpaceRegistry::instance()->profileAlias(_dstProfile); }
>
> KoColorConversionTransformationFactory::~KoColorConversionTransformationFa
> ctory() diff --git a/libs/pigment/KoColorSpaceRegistry.cpp
> b/libs/pigment/KoColorSpaceRegistry.cpp index 7439f13..b53495a 100644
> --- a/libs/pigment/KoColorSpaceRegistry.cpp
> +++ b/libs/pigment/KoColorSpaceRegistry.cpp
> @@ -185,10 +185,15 @@ void KoColorSpaceRegistry::addProfileAlias(const
> QString& name, const QString& t d->profileAlias[name] = to;
> }
>
> +QString KoColorSpaceRegistry::profileAlias(const QString& _name) const
> +{
> + return d->profileAlias.value(_name, _name);
> +}
> +
> const KoColorProfile * KoColorSpaceRegistry::profileByName(const QString
> & _name) const {
> QReadLocker l(&d->registrylock);
> - return d->profileMap.value( d->profileAlias.value(_name, _name) , 0);
> + return d->profileMap.value( profileAlias(_name), 0);
> }
>
> QList<const KoColorProfile *> KoColorSpaceRegistry::profilesFor(const
> QString &id) const diff --git a/libs/pigment/KoColorSpaceRegistry.h
> b/libs/pigment/KoColorSpaceRegistry.h index 272e82b..629e1b0 100644
> --- a/libs/pigment/KoColorSpaceRegistry.h
> +++ b/libs/pigment/KoColorSpaceRegistry.h
> @@ -96,6 +96,11 @@ public:
> * will return the profile @p to when passed @p name as a parameter.
> */
> void addProfileAlias(const QString& name, const QString& to);
> +
> + /**
> + * @return the profile alias, or name if not aliased
> + */
> + QString profileAlias(const QString& name) const;
>
> /**
> * create a profile of the specified type.
--
Cyrille Berger Skott
More information about the kimageshop
mailing list