Commit c3da541f authored by Cyrille Berger's avatar Cyrille Berger

* compare color space using operator== and not their pointers

* add a comparison of profiles

svn path=/trunk/koffice/; revision=742160
parent b6218065
......@@ -94,6 +94,8 @@ class PIGMENTCMS_EXPORT KoColorProfile {
* @return true if this profile is suitable to use for display
*/
virtual bool isSuitableForDisplay() const =0;
virtual bool operator==(const KoColorProfile&) const = 0;
protected:
/**
* Allows to define the name of this profile.
......
......@@ -30,6 +30,7 @@
#include "KoColorTransformationFactoryRegistry.h"
#include "KoColorConversionSystem.h"
#include "KoColorSpaceRegistry.h"
#include "KoColorProfile.h"
#include "KoCopyColorConversionTransformation.h"
#include "KoFallBackColorTransformation.h"
......@@ -83,6 +84,12 @@ KoColorSpace::~KoColorSpace()
delete d;
}
bool KoColorSpace::operator==(const KoColorSpace& rhs) const {
const KoColorProfile* p1 = rhs.profile();
const KoColorProfile* p2 = profile();
return id() == rhs.id() and (*p1 == *p2 ) ;
}
QString KoColorSpace::id() const {return d->id;}
QString KoColorSpace::name() const {return d->name;}
......@@ -336,7 +343,7 @@ void KoColorSpace::bitBlt(quint8 *dst,
const KoCompositeOp * op,
const QBitArray & channelFlags) const
{
Q_ASSERT(op->colorSpace() == this);
Q_ASSERT(*op->colorSpace() == *this);
if (rows <= 0 || cols <= 0)
return;
......@@ -387,7 +394,7 @@ void KoColorSpace::bitBlt(quint8 *dst,
qint32 cols,
const KoCompositeOp * op) const
{
Q_ASSERT(op->colorSpace() == this);
Q_ASSERT(*op->colorSpace() == *this);
if (rows <= 0 || cols <= 0)
return;
......
......@@ -135,9 +135,7 @@ public:
KoColorSpace(const QString &id, const QString &name, KoMixColorsOp* mixColorsOp, KoConvolutionOp* convolutionOp );
virtual ~KoColorSpace();
virtual bool operator==(const KoColorSpace& rhs) const {
return id() == rhs.id();
}
virtual bool operator==(const KoColorSpace& rhs) const;
public:
......
......@@ -34,7 +34,7 @@ KoHdrColorProfile::KoHdrColorProfile(const QString &name, const QString &info) :
setInfo(info);
}
KoHdrColorProfile::KoHdrColorProfile(const KoHdrColorProfile& rhs) : d(new Private(*rhs.d))
KoHdrColorProfile::KoHdrColorProfile(const KoHdrColorProfile& rhs) : KoColorProfile(), d(new Private(*rhs.d))
{
if(d->iccProfile)
{
......@@ -92,3 +92,13 @@ void KoHdrColorProfile::setHdrExposure(double exposure)
{
d->exposure = exposure;
}
bool KoHdrColorProfile::operator==(const KoColorProfile& rhs) const
{
const KoHdrColorProfile* rhsHdr = dynamic_cast<const KoHdrColorProfile*>(&rhs);
if(rhsHdr)
{
return *iccProfile() == *rhsHdr->iccProfile();
}
return false;
}
......@@ -41,6 +41,7 @@ class PIGMENTCMS_EXPORT KoHdrColorProfile : public KoColorProfile {
double hdrExposure() const;
void setHdrExposure(double exposure);
virtual bool operator==(const KoColorProfile&) const;
private:
struct Private;
Private* const d;
......
......@@ -251,3 +251,14 @@ KoLcmsColorProfileContainer* KoIccColorProfile::asLcms() const
Q_ASSERT( d->shared->lcmsProfile );
return d->shared->lcmsProfile;
}
bool KoIccColorProfile::operator==(const KoColorProfile& rhs) const
{
const KoIccColorProfile* rhsIcc = dynamic_cast<const KoIccColorProfile*>(&rhs);
if(rhsIcc)
{
return d->shared == rhsIcc->d->shared;
}
return false;
}
......@@ -80,6 +80,7 @@ class PIGMENTCMS_EXPORT KoIccColorProfile : public KoColorProfile {
virtual bool isSuitableForOutput() const;
virtual bool isSuitableForPrinting() const;
virtual bool isSuitableForDisplay() const;
virtual bool operator==(const KoColorProfile&) const;
protected:
void setRawData(const QByteArray& rawData);
public:
......
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