Commit 4e83cf20 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Implement KoColorSpace::operator!=()

We had this bug for ages, what a shame! :)
parent b1142e2d
......@@ -82,7 +82,7 @@ KisFixedPaintDeviceSP KisPaintOp::cachedDab()
KisFixedPaintDeviceSP KisPaintOp::cachedDab(const KoColorSpace *cs)
{
if (!d->dab || !(*d->dab->colorSpace() == *cs)) {
if (!d->dab || *d->dab->colorSpace() != *cs) {
d->dab = new KisFixedPaintDevice(cs);
}
return d->dab;
......
......@@ -115,7 +115,7 @@ void KisFilter::process(const KisPaintDeviceSP src,
bool weirdDstColorSpace =
dst->colorSpace() != dst->compositionSourceColorSpace() &&
!(*dst->colorSpace() == *dst->compositionSourceColorSpace());
*dst->colorSpace() != *dst->compositionSourceColorSpace();
if(src == dst && !selection && !weirdDstColorSpace) {
temporary = src;
......
......@@ -185,7 +185,7 @@ void KisGroupLayer::resetCache(const KoColorSpace *colorSpace)
m_d->paintDevice = dev;
m_d->paintDevice->setProjectionDevice(true);
}
else if(!(*m_d->paintDevice->colorSpace() == *colorSpace)) {
else if(*m_d->paintDevice->colorSpace() != *colorSpace) {
KisPaintDeviceSP dev = new KisPaintDevice(this, colorSpace, new KisDefaultBounds(image()));
dev->setX(this->x());
......
......@@ -64,7 +64,7 @@ public:
m_reusablePaintDevice = new KisPaintDevice(*prototype);
}
if(!m_projection ||
!(*m_projection->colorSpace() == *prototype->colorSpace())) {
*m_projection->colorSpace() != *prototype->colorSpace()) {
m_projection = m_reusablePaintDevice;
m_projection->makeCloneFromRough(prototype, prototype->extent());
m_projection->setProjectionDevice(true);
......
......@@ -768,7 +768,7 @@ void KisPaintDevice::Private::uploadFrame(int dstFrameId, KisPaintDeviceSP srcDe
void KisPaintDevice::Private::uploadFrameData(DataSP srcData, DataSP dstData)
{
if (srcData->colorSpace() != dstData->colorSpace() &&
!(*srcData->colorSpace() == *dstData->colorSpace())) {
*srcData->colorSpace() != *dstData->colorSpace()) {
KUndo2Command tempCommand;
......
......@@ -196,7 +196,7 @@ void KisSelectionBasedLayer::resetCache(const KoColorSpace *colorSpace)
colorSpace = image()->colorSpace();
if (!m_d->paintDevice ||
!(*m_d->paintDevice->colorSpace() == *colorSpace)) {
*m_d->paintDevice->colorSpace() != *colorSpace) {
m_d->paintDevice = new KisPaintDevice(this, colorSpace, new KisDefaultBounds(image()));
} else {
......
......@@ -64,7 +64,7 @@ KisPaintDeviceSP KisMultipleProjection::getProjection(const QString &id, const Q
if (constIt == m_d->planes.constEnd() ||
constIt->compositeOpId != compositeOpId ||
!(*constIt->device->colorSpace() == *prototype->colorSpace())) {
*constIt->device->colorSpace() != *prototype->colorSpace()) {
readLocker.unlock();
......@@ -79,7 +79,7 @@ KisPaintDeviceSP KisMultipleProjection::getProjection(const QString &id, const Q
plane.compositeOpId = compositeOpId;
writeIt = m_d->planes.insert(id, plane);
} else if (writeIt->compositeOpId != compositeOpId ||
!(*writeIt->device->colorSpace() == *prototype->colorSpace())) {
*writeIt->device->colorSpace() != *prototype->colorSpace()) {
writeIt->device->prepareClone(prototype);
writeIt->compositeOpId = compositeOpId;
......
......@@ -80,7 +80,7 @@ void KisCsConversionTest::testColorSpaceConversion()
logFailure("pixelsize", srcCs, dstCs);
failedColorSpaces++;
}
if (!(*dev->colorSpace() == *dstCs)) {
if (*dev->colorSpace() != *dstCs) {
logFailure("dest cs", srcCs, dstCs);
failedColorSpaces++;
}
......
......@@ -135,7 +135,7 @@ KoColor & KoColor::operator=(const KoColor & rhs)
bool KoColor::operator==(const KoColor &other) const
{
if (!(*colorSpace() == *other.colorSpace()))
if (*colorSpace() != *other.colorSpace())
return false;
return memcmp(d->data, other.d->data, d->colorSpace->pixelSize()) == 0;
}
......
......@@ -27,6 +27,7 @@
#include <QVector>
#include <QList>
#include <boost/operators.hpp>
#include "KoColorSpaceConstants.h"
#include "KoColorConversionTransformation.h"
#include "KoColorProofingConversionTransformation.h"
......@@ -84,7 +85,7 @@ class KoConvolutionOp;
* Some subclasses implement only some parts and are named Traits
*
*/
class KRITAPIGMENT_EXPORT KoColorSpace
class KRITAPIGMENT_EXPORT KoColorSpace : public boost::equality_comparable<KoColorSpace>
{
friend class KoColorSpaceRegistry;
friend class KoColorSpaceFactory;
......
......@@ -520,7 +520,7 @@ void KoGradientSegment::RGBColorInterpolationStrategy::colorAt(KoColor& dst, qre
//check if our mixspace exists, it doesn't at startup.
if (mixSpace){
if ( !(*buffer.colorSpace() == *mixSpace)) {
if (*buffer.colorSpace() != *mixSpace) {
buffer = KoColor(mixSpace);
}
mixSpace->mixColorsOp()->mixColors(colors, colorWeights, 2, buffer.data());
......
......@@ -156,7 +156,7 @@ void KoStopGradient::colorAt(KoColor& dst, qreal t) const
break;
}
//if ( !(*buffer.colorSpace() == *colorSpace())) {
//if ( *buffer.colorSpace() != *colorSpace()) {
// buffer = KoColor(colorSpace());
//}
//hack to get a color space with the bitdepth of the gradients(8bit), but with the colour profile of the image//
......@@ -191,7 +191,7 @@ void KoStopGradient::colorAt(KoColor& dst, qreal t) const
//check if our mixspace exists, it doesn't at startup.
if (mixSpace){
if ( !(*buffer.colorSpace() == *mixSpace)) {
if (*buffer.colorSpace() != *mixSpace) {
buffer = KoColor(mixSpace);
}
mixSpace->mixColorsOp()->mixColors(colors, colorWeights, 2, buffer.data());
......
......@@ -476,7 +476,7 @@ KisDisplayColorConverter::Private::convertToQImageDirect(KisPaintDeviceSP device
QImage KisDisplayColorConverter::toQImage(KisPaintDeviceSP srcDevice) const
{
KisPaintDeviceSP device = srcDevice;
if (!(*device->colorSpace() == *m_d->paintingColorSpace)) {
if (*device->colorSpace() != *m_d->paintingColorSpace) {
device = new KisPaintDevice(*srcDevice);
KUndo2Command *cmd = device->convertTo(m_d->paintingColorSpace);
......
......@@ -364,8 +364,8 @@ void KisLayerManager::convertNodeToPaintLayer(KisNodeSP source)
KisPaintDeviceSP clone;
if (!(*srcDevice->colorSpace() ==
*srcDevice->compositionSourceColorSpace())) {
if (*srcDevice->colorSpace() !=
*srcDevice->compositionSourceColorSpace()) {
clone = new KisPaintDevice(srcDevice->compositionSourceColorSpace());
......
......@@ -179,7 +179,7 @@ bool KisKraLoadVisitor::visit(KisPaintLayer *layer)
bool KisKraLoadVisitor::visit(KisGroupLayer *layer)
{
if (!(*layer->colorSpace() == *m_image->colorSpace())) {
if (*layer->colorSpace() != *m_image->colorSpace()) {
layer->resetCache(m_image->colorSpace());
}
......
......@@ -112,7 +112,7 @@ void KisFilterStrokeStrategy::initStrokeCallback()
if (activeSelection() ||
(dev->colorSpace() != dev->compositionSourceColorSpace() &&
!(dev->colorSpace() == dev->compositionSourceColorSpace()))) {
*dev->colorSpace() != *dev->compositionSourceColorSpace())) {
m_d->filterDevice = dev->createCompositionSourceDevice(dev);
m_d->secondaryTransaction = new KisTransaction(m_d->filterDevice);
......
......@@ -106,7 +106,7 @@ void KisPlainColorSource::selectColor(double mix, const KisPaintInformation &pi)
{
Q_UNUSED(pi);
if (!(m_color.colorSpace() == m_foreGroundColor.colorSpace())) {
if (m_color.colorSpace() != m_foreGroundColor.colorSpace()) {
m_color = KoColor(m_foreGroundColor.colorSpace());
m_cachedBackGroundColor = KoColor(m_foreGroundColor.colorSpace());
m_cachedBackGroundColor.fromKoColor(m_backGroundColor);
......
......@@ -349,7 +349,7 @@ KisFixedPaintDeviceSP KisDabCache::fetchDabCommon(const KoColorSpace *cs,
softnessFactor,
mirrorProperties);
if (!m_d->dab || !(*m_d->dab->colorSpace() == *cs)) {
if (!m_d->dab || *m_d->dab->colorSpace() != *cs) {
m_d->dab = new KisFixedPaintDevice(cs);
}
else if (cachingIsPossible) {
......@@ -372,7 +372,7 @@ KisFixedPaintDeviceSP KisDabCache::fetchDabCommon(const KoColorSpace *cs,
softnessFactor);
}
else {
if (!m_d->colorSourceDevice || !(*cs == *m_d->colorSourceDevice->colorSpace())) {
if (!m_d->colorSourceDevice || *cs != *m_d->colorSourceDevice->colorSpace()) {
m_d->colorSourceDevice = new KisPaintDevice(cs);
}
else {
......@@ -395,7 +395,7 @@ KisFixedPaintDeviceSP KisDabCache::fetchDabCommon(const KoColorSpace *cs,
}
if (needSeparateOriginal()) {
if (!m_d->dabOriginal || !(*cs == *m_d->dabOriginal->colorSpace())) {
if (!m_d->dabOriginal || *cs != *m_d->dabOriginal->colorSpace()) {
m_d->dabOriginal = new KisFixedPaintDevice(cs);
}
......
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