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

List:       kde-commits
Subject:    [calligra] libs/pigment: Do not map the empty profile name to a profile named "Dummy profile"
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2013-11-01 9:17:38
Message-ID: E1VcArK-00052B-CO () scm ! kde ! org
[Download RAW message or body]

Git commit 544a46e0338d2915ec677892466fc2350969c8bb by Boudewijn Rempt.
Committed on 01/11/2013 at 09:15.
Pushed by rempt into branch 'master'.

Do not map the empty profile name to a profile named "Dummy profile"

"Dummy profile" is very descriptive, but if we map a request for a
colorspace with an empty profile name to a colorspace with a profile
named "Dummy profile" the mapping function gets all confused.

M  +1    -1    libs/pigment/KoColorConversionSystem.cpp
M  +7    -6    libs/pigment/KoColorSpaceRegistry.cpp
M  +1    -1    libs/pigment/colorprofiles/KoDummyColorProfile.cpp
M  +1    -1    libs/pigment/tests/TestColorConversionSystem.cpp

http://commits.kde.org/calligra/544a46e0338d2915ec677892466fc2350969c8bb

diff --git a/libs/pigment/KoColorConversionSystem.cpp \
b/libs/pigment/KoColorConversionSystem.cpp index 6cca1a5..4bd26f7 100644
--- a/libs/pigment/KoColorConversionSystem.cpp
+++ b/libs/pigment/KoColorConversionSystem.cpp
@@ -46,7 +46,7 @@ KoColorConversionSystem::KoColorConversionSystem() : d(new Private)
     d->alphaNode->crossingCost = 1000000;
     d->alphaNode->isInitialized = true;
     d->alphaNode->isGray = true; // <- FIXME: it's a little bit hacky as alpha \
                doesn't really have color information
-    d->graph[ NodeKey(d->alphaNode->modelId, d->alphaNode->depthId, "Dummy \
profile")] = d->alphaNode; +    d->graph[ NodeKey(d->alphaNode->modelId, \
d->alphaNode->depthId, "")] = d->alphaNode;  
     Vertex* v = createVertex(d->alphaNode, d->alphaNode);
     v->setFactoryFromSrc(new \
KoCopyColorConversionTransformationFactory(AlphaColorModelID.id(), \
                Integer8BitsColorDepthID.id(), ""));
diff --git a/libs/pigment/KoColorSpaceRegistry.cpp \
b/libs/pigment/KoColorSpaceRegistry.cpp index d2c61ec..0602919 100644
--- a/libs/pigment/KoColorSpaceRegistry.cpp
+++ b/libs/pigment/KoColorSpaceRegistry.cpp
@@ -344,10 +344,6 @@ const KoColorSpace * KoColorSpaceRegistry::colorSpace(const \
QString &csID, const  }
 
         QWriteLocker l(&d->registrylock);
-        Q_ASSERT(cs->id() == csID);
-        Q_ASSERT(cs->profile()->name() == profileName);
-        d->csMap[idsToCacheName(cs->id(), cs->profile()->name())] = cs;
-        cs->d->deletability = OwnedByRegistryDoNotDelete;
         dbgPigmentCSRegistry << "colorspace count: " << d->csMap.count()
                              << ", adding name: " << idsToCacheName(cs->id(), \
cs->profile()->name())  << "\n\tcsID" << csID
@@ -355,6 +351,11 @@ const KoColorSpace * KoColorSpaceRegistry::colorSpace(const \
QString &csID, const  << "\n\tcs->id()" << cs->id()
                              << "\n\tcs->profile()->name()" << cs->profile()->name()
                              << "\n\tpName" << pName;
+        Q_ASSERT(cs->id() == csID);
+        Q_ASSERT(cs->profile()->name() == profileName);
+        d->csMap[idsToCacheName(cs->id(), cs->profile()->name())] = cs;
+        cs->d->deletability = OwnedByRegistryDoNotDelete;
+
     }
     QReadLocker l(&d->registrylock);
 
@@ -426,7 +427,7 @@ const KoColorSpace * KoColorSpaceRegistry::rgb8(const QString \
&profileName)  {
     if (profileName.isEmpty()) {
         if (!d->rgbU8sRGB) {
-            d->rgbU8sRGB = colorSpace(KoRgbU8ColorSpace::colorSpaceId(), \
profileName); +            d->rgbU8sRGB = \
colorSpace(KoRgbU8ColorSpace::colorSpaceId(), "");  }
         Q_ASSERT(d->rgbU8sRGB);
         return d->rgbU8sRGB;
@@ -438,7 +439,7 @@ const KoColorSpace * KoColorSpaceRegistry::rgb8(const \
KoColorProfile * profile)  {
     if (profile == 0) {
         if (!d->rgbU8sRGB) {
-            d->rgbU8sRGB = colorSpace(KoRgbU8ColorSpace::colorSpaceId(), profile);
+            d->rgbU8sRGB = colorSpace(KoRgbU8ColorSpace::colorSpaceId(), "");
         }
         Q_ASSERT(d->rgbU8sRGB);
         return d->rgbU8sRGB;
diff --git a/libs/pigment/colorprofiles/KoDummyColorProfile.cpp \
b/libs/pigment/colorprofiles/KoDummyColorProfile.cpp index 1e8821c..d6904fd 100644
--- a/libs/pigment/colorprofiles/KoDummyColorProfile.cpp
+++ b/libs/pigment/colorprofiles/KoDummyColorProfile.cpp
@@ -21,7 +21,7 @@
 
 KoDummyColorProfile::KoDummyColorProfile()
 {
-    setName("Dummy profile");
+    setName("");
 }
 
 KoDummyColorProfile::~KoDummyColorProfile()
diff --git a/libs/pigment/tests/TestColorConversionSystem.cpp \
b/libs/pigment/tests/TestColorConversionSystem.cpp index 247788d..bfbece5 100644
--- a/libs/pigment/tests/TestColorConversionSystem.cpp
+++ b/libs/pigment/tests/TestColorConversionSystem.cpp
@@ -39,7 +39,7 @@ TestColorConversionSystem::TestColorConversionSystem()
             }
         }
     }
-    listModels.append(ModelDepthProfile(AlphaColorModelID.id(), \
Integer8BitsColorDepthID.id(), "Dummy profile")); +    \
listModels.append(ModelDepthProfile(AlphaColorModelID.id(), \
Integer8BitsColorDepthID.id(), ""));  }
 
 void TestColorConversionSystem::testConnections()


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

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