Commit e3f9f6d8 authored by Boudewijn Rempt's avatar Boudewijn Rempt

* Fix some warnings

* Use the right debug area for pigment (30008 lib pigment)
* define DBG_PIGMENT for 30008 and use it everywhere. Hope that makes
everyone happy.

svn path=/trunk/koffice/; revision=752048
parent 841d8d7e
......@@ -147,7 +147,7 @@ bool KoColor::operator==(const KoColor &other) const
void KoColor::convertTo(const KoColorSpace * cs)
{
//kDebug(DBG_AREA_CMS) <<"Our colormodel:" << d->colorSpace->id().name()
//kDebug(DBG_PIGMENT) <<"Our colormodel:" << d->colorSpace->id().name()
// << ", new colormodel: " << cs->id().name() << "\n";
if (d->colorSpace == cs)
......@@ -211,7 +211,7 @@ void KoColor::fromQColor(const QColor& c, quint8 opacity) const
#ifndef NDEBUG
void KoColor::dump() const
{
//kDebug(DBG_AREA_CMS) <<"KoColor (" << this <<")," << d->colorSpace->id().name() <<"";
//kDebug(DBG_PIGMENT) <<"KoColor (" << this <<")," << d->colorSpace->id().name() <<"";
QList<KoChannelInfo *> channels = d->colorSpace->channels();
QList<KoChannelInfo *>::const_iterator begin = channels.begin();
......@@ -223,15 +223,15 @@ void KoColor::dump() const
// XXX: setNum always takes a byte.
if (ch->size() == sizeof(quint8)) {
// Byte
//kDebug(DBG_AREA_CMS) <<"Channel (byte):" << ch->name() <<":" << QString().setNum(d->data[ch->pos()]) <<"";
//kDebug(DBG_PIGMENT) <<"Channel (byte):" << ch->name() <<":" << QString().setNum(d->data[ch->pos()]) <<"";
}
else if (ch->size() == sizeof(quint16)) {
// Short (may also by an nvidia half)
//kDebug(DBG_AREA_CMS) <<"Channel (short):" << ch->name() <<":" << QString().setNum(*((const quint16 *)(d->data+ch->pos()))) <<"";
//kDebug(DBG_PIGMENT) <<"Channel (short):" << ch->name() <<":" << QString().setNum(*((const quint16 *)(d->data+ch->pos()))) <<"";
}
else if (ch->size() == sizeof(quint32)) {
// Integer (may also be float... Find out how to distinguish these!)
//kDebug(DBG_AREA_CMS) <<"Channel (int):" << ch->name() <<":" << QString().setNum(*((const quint32 *)(d->data+ch->pos()))) <<"";
//kDebug(DBG_PIGMENT) <<"Channel (int):" << ch->name() <<":" << QString().setNum(*((const quint32 *)(d->data+ch->pos()))) <<"";
}
}
}
......
......@@ -61,7 +61,7 @@ KoColorConversionSystem::~KoColorConversionSystem()
void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
{
kDebug(31000) << "Inserting color space " << csf->name() << " (" << csf->id() << ") Model: " << csf->colorModelId() << " Depth: " << csf->colorDepthId() << " into the CCS";
kDebug(DBG_PIGMENT) << "Inserting color space " << csf->name() << " (" << csf->id() << ") Model: " << csf->colorModelId() << " Depth: " << csf->colorDepthId() << " into the CCS";
QString modelId = csf->colorModelId().id();
QString depthId = csf->colorDepthId().id();
NodeKey key(modelId, depthId);
......@@ -78,7 +78,7 @@ void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
// ICC Connection
if(csNode->isIcc)
{ // Construct a link between this color space and all other ICC color space
kDebug(31000) << csf->id() << " is an ICC color space, connecting to others";
kDebug(DBG_PIGMENT) << csf->id() << " is an ICC color space, connecting to others";
QList<Node*> nodes = d->graph.values();
foreach(Node* node, nodes)
{
......@@ -103,14 +103,14 @@ void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
}
// Construct a link for "custom" transformation
QList<KoColorConversionTransformationFactory*> cctfs = csf->colorConversionLinks();
kDebug(31000) << csf->id() << " has " << cctfs.size() << " direct connections";
kDebug(DBG_PIGMENT) << csf->id() << " has " << cctfs.size() << " direct connections";
foreach(KoColorConversionTransformationFactory* cctf, cctfs)
{
Node* srcNode = nodeFor(cctf->srcColorModelId(), cctf->srcColorDepthId());
Q_ASSERT(srcNode);
Node* dstNode = nodeFor(cctf->dstColorModelId(), cctf->dstColorDepthId());
Q_ASSERT(dstNode);
kDebug(31000) << "Connecting " << srcNode->id() << " to " << dstNode->id();
kDebug(DBG_PIGMENT) << "Connecting " << srcNode->id() << " to " << dstNode->id();
Q_ASSERT(srcNode == csNode or dstNode == csNode);
// Check if the two nodes are allready connected
Vertex* v = vertexBetween(srcNode, dstNode);
......@@ -133,7 +133,7 @@ void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
if( not v)
{
v = createVertex(csNode, csNode);
kDebug(31000) << "No self to self color conversion, add the copy one";
kDebug(DBG_PIGMENT) << "No self to self color conversion, add the copy one";
v->setFactoryFromSrc( new KoCopyColorConversionTransformationFactory(modelId, depthId));
}
}
......@@ -235,16 +235,16 @@ KoColorConversionTransformation* KoColorConversionSystem::createTransformationFr
const KoColorSpace* intermCS = defaultColorSpaceForNode( path->vertexes.first()->dstNode );
mccTransfo->appendTransfo( path->vertexes.first()->factory()->createColorTransformation(srcColorSpace, intermCS, renderingIntent) );
kDebug(31000) << path->vertexes.first()->srcNode->id() << " to " << path->vertexes.first()->dstNode->id();
kDebug(DBG_PIGMENT) << path->vertexes.first()->srcNode->id() << " to " << path->vertexes.first()->dstNode->id();
for(int i = 1; i < path->length() - 1; i++)
{
Vertex* v = path->vertexes[i];
kDebug(31000) << v->srcNode->id() << " to " << v->dstNode->id();
kDebug(DBG_PIGMENT) << v->srcNode->id() << " to " << v->dstNode->id();
const KoColorSpace* intermCS2 = defaultColorSpaceForNode( v->dstNode );
mccTransfo->appendTransfo( v->factory()->createColorTransformation(intermCS, intermCS2, renderingIntent) );
intermCS = intermCS2;
}
kDebug(31000) << path->vertexes.last()->srcNode->id() << " to " << path->vertexes.last()->dstNode->id();
kDebug(DBG_PIGMENT) << path->vertexes.last()->srcNode->id() << " to " << path->vertexes.last()->dstNode->id();
mccTransfo->appendTransfo( path->vertexes.last()->factory()->createColorTransformation(intermCS, dstColorSpace, renderingIntent) );
}
......@@ -416,10 +416,10 @@ inline KoColorConversionSystem::Path* KoColorConversionSystem::findBestPathImpl2
}
if(lessWorsePath)
{
kWarning(31000) << "No good path from " << srcNode->id() << " to " << dstNode->id() << " found !";
kWarning(DBG_PIGMENT) << "No good path from " << srcNode->id() << " to " << dstNode->id() << " found !";
return lessWorsePath;
}
kError(31000) << "No path from " << srcNode->id() << " to " << dstNode->id() << " found !";
kError(DBG_PIGMENT) << "No path from " << srcNode->id() << " to " << dstNode->id() << " found !";
return 0;
}
......@@ -435,7 +435,7 @@ inline KoColorConversionSystem::Path* KoColorConversionSystem::findBestPathImpl(
KoColorConversionSystem::Path* KoColorConversionSystem::findBestPath( const KoColorConversionSystem::Node* srcNode, const KoColorConversionSystem::Node* dstNode) const
{
// kDebug(31000) << "Find best path between " << srcNode->id() << " and " << dstNode->id();
// kDebug(DBG_PIGMENT) << "Find best path between " << srcNode->id() << " and " << dstNode->id();
if(srcNode->isHdr and dstNode->isHdr)
{
return findBestPathImpl(srcNode, dstNode, false);
......
......@@ -307,7 +307,7 @@ void KoColorSpace::bitBlt(quint8 *dst,
const KoCompositeOp * op,
const QBitArray & channelFlags) const
{
kDebug(31000) << "Composite op is for color space " << op->colorSpace()->id() << " and this is " << id();
kDebug(DBG_PIGMENT) << "Composite op is for color space " << op->colorSpace()->id() << " and this is " << id();
Q_ASSERT_X(*op->colorSpace() == *this, "KoColorSpace::bitBlt", QString("Composite op is for color space %1 while this is %2" ).arg( op->colorSpace()->id() ).arg(id()).toLatin1() );
if (rows <= 0 || cols <= 0)
......
......@@ -27,4 +27,6 @@
const quint8 OPACITY_TRANSPARENT = 0;
const quint8 OPACITY_OPAQUE = UCHAR_MAX;
#define DBG_PIGMENT 30008
#endif
......@@ -93,10 +93,10 @@ void KoColorSpaceRegistry::init()
profile->load();
if (profile->valid()) {
kDebug(31000) << "Valid profile : " << profile->name();
kDebug(DBG_PIGMENT) << "Valid profile : " << profile->name();
d->profileMap[profile->name()] = profile;
} else {
kDebug(31000) << "Invalid profile : " << profile->name();
kDebug(DBG_PIGMENT) << "Invalid profile : " << profile->name();
}
}
}
......@@ -124,7 +124,7 @@ void KoColorSpaceRegistry::init()
cmsHPROFILE hProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma);
cmsFreeGamma(Gamma);
KoColorProfile *defProfile = KoLcmsColorProfileContainer::createFromLcmsProfile(hProfile);
kDebug(31000) << "Gray " << defProfile->name();
kDebug(DBG_PIGMENT) << "Gray " << defProfile->name();
addProfile(defProfile);
// Create the built-in colorspaces
......@@ -246,14 +246,14 @@ const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString &csID, const
KoColorSpaceFactory *csf = value(csID);
if(!csf)
{
kDebug(31000) <<"Unknown color space type :" << csf;
kDebug(DBG_PIGMENT) <<"Unknown color space type :" << csf;
return 0;
}
const KoColorProfile *p = profileByName(profileName);
if(!p && !profileName.isEmpty())
{
kDebug(31000) <<"Profile not found :" << profileName;
kDebug(DBG_PIGMENT) <<"Profile not found :" << profileName;
return 0;
}
const KoColorSpace *cs = csf->createColorSpace( p);
......@@ -286,7 +286,7 @@ const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString &csID, const
KoColorSpaceFactory *csf = value(csID);
if(!csf)
{
kDebug(31000) <<"Unknown color space type :" << csf;
kDebug(DBG_PIGMENT) <<"Unknown color space type :" << csf;
return 0;
}
......
......@@ -76,7 +76,7 @@ quint32 KoLcmsColorConversionTransformationFactory::computeColorSpaceType(QStrin
} else if(_depthId == Integer16BitsColorDepthID.id()) {
depthType = BYTES_SH(2);
} else {
kDebug(31000) << "Unknow bit depth";
kDebug(DBG_PIGMENT) << "Unknow bit depth";
return 0;
}
// Compute the model part of the type
......@@ -103,7 +103,7 @@ quint32 KoLcmsColorConversionTransformationFactory::computeColorSpaceType(QStrin
{
modelType = (COLORSPACE_SH(PT_YCbCr)|EXTRA_SH(1)|CHANNELS_SH(3));
} else {
kDebug(31000) << "Unknow color model";
kDebug(DBG_PIGMENT) << "Unknow color model";
return 0;
}
return depthType|modelType;
......
......@@ -410,9 +410,6 @@ bool KoAlphaColorSpace::convertPixelsTo(const quint8 *src,
// No lcms trickery here, we are only a opacity channel
qint32 size = dstColorSpace->pixelSize();
quint32 j = 0;
quint32 i = 0;
memset(dst, 0, numPixels * size);
dstColorSpace->applyInverseAlphaU8Mask(dst, src, numPixels);
......
......@@ -124,35 +124,35 @@ public:
virtual KoColorTransformation* createBrightnessContrastAdjustment(const quint16* transferValues) const
{
Q_UNUSED(transferValues);
kDebug() <<"Undefined operation in the alpha colorspace";
kWarning() << i18n("Undefined operation in the alpha colorspace");
return 0;
}
virtual KoColorTransformation* createDesaturateAdjustment() const
{
kDebug() <<"Undefined operation in the alpha colorspace";
kWarning() << i18n("Undefined operation in the alpha colorspace");
return 0;
}
virtual KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const
{
kDebug() <<"Undefined operation in the alpha colorspace";
kWarning() << i18n("Undefined operation in the alpha colorspace");
return 0;
}
virtual KoColorTransformation *createDarkenAdjustment(qint32 , bool , double ) const
{
kDebug() <<"Undefined operation in the alpha colorspace";
kWarning() << i18n("Undefined operation in the alpha colorspace");
return 0;
}
virtual void invertColor(quint8*, qint32) const
{
kDebug() <<"Undefined operation in the alpha colorspace";
kWarning() << i18n("Undefined operation in the alpha colorspace");
}
virtual void colorToXML( const quint8* , QDomDocument& , QDomElement& ) const
{
kDebug() <<"Undefined operation in the alpha colorspace";
kWarning() << i18n("Undefined operation in the alpha colorspace");
}
virtual void colorFromXML( quint8* , const QDomElement& ) const
{
kDebug() <<"Undefined operation in the alpha colorspace";
kWarning() << i18n("Undefined operation in the alpha colorspace");
}
public:
......
......@@ -48,12 +48,12 @@ void TestKoColor::testForModel(QString model)
kc.toXML(doc, elt);
doc.appendChild(elt);
KoColor kcu = KoColor::fromXML(elt.firstChildElement(), depthId.id(), QHash<QString,QString>());
QVERIFY2(*(kc.colorSpace()) == *(kcu.colorSpace()), QString("Not identical color space colorModelId = %1 depthId = %2").arg(model).arg(depthId.id()).latin1());
QVERIFY2(*(kc.colorSpace()) == *(kcu.colorSpace()), QString("Not identical color space colorModelId = %1 depthId = %2").arg(model).arg(depthId.id()).toLatin1());
QColor qc2 = kc.toQColor();
QColor qcu = kcu.toQColor();
QVERIFY2( nearEqualValue(qcu.red(), qc2.red()), QString("Unserialization failed colorModelId = %1 depthId = %2 red = %3 red = %4").arg(model).arg(depthId.id()).arg(qcu.red()).arg(qc2.red()).latin1());
QVERIFY2( nearEqualValue(qcu.green(), qc2.green()), QString("Unserialization failed colorModelId = %1 depthId = %2 green = %3 green = %4").arg(model).arg(depthId.id()).arg(qcu.green()).arg(qc2.green()).latin1());
QVERIFY2( nearEqualValue(qcu.blue(), qc2.blue()), QString("Unserialization failed colorModelId = %1 depthId = %2 blue = %3 blue = %4").arg(model).arg(depthId.id()).arg(qcu.blue()).arg(qc2.blue()).latin1());
QVERIFY2( nearEqualValue(qcu.red(), qc2.red()), QString("Unserialization failed colorModelId = %1 depthId = %2 red = %3 red = %4").arg(model).arg(depthId.id()).arg(qcu.red()).arg(qc2.red()).toLatin1());
QVERIFY2( nearEqualValue(qcu.green(), qc2.green()), QString("Unserialization failed colorModelId = %1 depthId = %2 green = %3 green = %4").arg(model).arg(depthId.id()).arg(qcu.green()).arg(qc2.green()).toLatin1());
QVERIFY2( nearEqualValue(qcu.blue(), qc2.blue()), QString("Unserialization failed colorModelId = %1 depthId = %2 blue = %3 blue = %4").arg(model).arg(depthId.id()).arg(qcu.blue()).arg(qc2.blue()).toLatin1());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment