Commit adb3d4e4 authored by Cyrille Berger's avatar Cyrille Berger

* KoColorSpace are now used as const pointers

* KoColorProfile are on their way to be used as const pointers

svn path=/trunk/koffice/; revision=735865
parent b7dde86e
......@@ -96,11 +96,11 @@ class KisRgbFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
virtual bool hasHighDynamicRange() const { return true; }
virtual KoColorProfile *profile() const { return m_profile; }
virtual const KoColorProfile *profile() const { return m_profile; }
virtual bool profileIsCompatible(KoColorProfile* profile) const
virtual bool profileIsCompatible(const KoColorProfile* profile) const
{
KoIccColorProfile *lcmsProfile = dynamic_cast<KoIccColorProfile *>(profile);
const KoIccColorProfile *lcmsProfile = dynamic_cast<const KoIccColorProfile *>(profile);
if (lcmsProfile) {
if (lcmsProfile->asLcms()->colorSpaceSignature() == icSigRgbData) {
return true;
......@@ -116,7 +116,7 @@ class KisRgbFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
return true;
}
virtual void fromQColor(const QColor& c, quint8 *dstU8, KoColorProfile * /*profile*/) const
virtual void fromQColor(const QColor& c, quint8 *dstU8, const KoColorProfile * /*profile*/) const
{
typename _CSTraits::channels_type* dst = _CSTraits::nativeArray(dstU8);
dst[ _CSTraits::red_pos ] = UINT8_TO_FLOAT(c.red());
......@@ -124,7 +124,7 @@ class KisRgbFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
dst[ _CSTraits::blue_pos ] = UINT8_TO_FLOAT(c.blue());
}
virtual void fromQColor(const QColor& c, quint8 opacity, quint8 *dstU8, KoColorProfile * /*profile*/) const
virtual void fromQColor(const QColor& c, quint8 opacity, quint8 *dstU8, const KoColorProfile * /*profile*/) const
{
typename _CSTraits::channels_type* dst = _CSTraits::nativeArray(dstU8);
dst[ _CSTraits::red_pos ] = UINT8_TO_FLOAT(c.red());
......@@ -133,13 +133,13 @@ class KisRgbFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
dst[ _CSTraits::alpha_pos ] = UINT8_TO_FLOAT(opacity);
}
virtual void toQColor(const quint8 *srcU8, QColor *c, KoColorProfile * /*profile*/) const
virtual void toQColor(const quint8 *srcU8, QColor *c, const KoColorProfile * /*profile*/) const
{
const typename _CSTraits::channels_type* src = _CSTraits::nativeArray(srcU8);
c->setRgb(FLOAT_TO_UINT8(src[_CSTraits::red_pos]), FLOAT_TO_UINT8(src[_CSTraits::green_pos]), FLOAT_TO_UINT8(src[_CSTraits::blue_pos]));
}
virtual void toQColor(const quint8 *srcU8, QColor *c, quint8 *opacity, KoColorProfile * /*profile*/) const
virtual void toQColor(const quint8 *srcU8, QColor *c, quint8 *opacity, const KoColorProfile * /*profile*/) const
{
const typename _CSTraits::channels_type* src = _CSTraits::nativeArray(srcU8);
c->setRgb(FLOAT_TO_UINT8(src[_CSTraits::red_pos]), FLOAT_TO_UINT8(src[_CSTraits::green_pos]), FLOAT_TO_UINT8(src[_CSTraits::blue_pos]));
......@@ -157,7 +157,7 @@ class KisRgbFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
virtual QImage convertToQImage(const quint8 *dataU8, qint32 width, qint32 height,
KoColorProfile *dstProfile,
const KoColorProfile *dstProfile,
KoColorConversionTransformation::Intent renderingIntent,
float exposure) const
{
......@@ -247,7 +247,7 @@ class KisRgbFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
KoIccColorProfile *m_profile;
KoLcmsColorProfileContainer *m_profileLcms;
KoColorSpace *m_rgbU16ColorSpace;
const KoColorSpace *m_rgbU16ColorSpace;
friend class KisRgbFloatHDRColorSpaceTest;
};
......@@ -255,9 +255,9 @@ class KisRgbFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
class KisRgbFloatHDRColorSpaceFactory : public KoColorSpaceFactory
{
public:
virtual bool profileIsCompatible(KoColorProfile* profile) const
virtual bool profileIsCompatible(const KoColorProfile* profile) const
{
KoIccColorProfile *lcmsProfile = dynamic_cast<KoIccColorProfile *>(profile);
const KoIccColorProfile *lcmsProfile = dynamic_cast<const KoIccColorProfile *>(profile);
if (lcmsProfile) {
if (lcmsProfile->asLcms()->colorSpaceSignature() == icSigRgbData) {
return true;
......
......@@ -108,7 +108,7 @@ void KisRgbFloatHDRColorSpaceTest::testProfile()
KoIccColorProfile *profile = new KoIccColorProfile(chromaticities, gamma);
KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId, profile);
const KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId, profile);
QVERIFY2(colorSpace != 0, "Created colorspace");
QCOMPARE(colorSpace->profile(), profile);
......@@ -232,11 +232,11 @@ void KisRgbFloatHDRColorSpaceTest::testFactory()
QVERIFY(colorSpaceFactory->profileIsCompatible(profile));
KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId, 0);
const KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId, 0);
QVERIFY2(colorSpace != 0, "Created colorspace");
QVERIFY2(colorSpace->profile() != 0, "Has a profile by default");
KoIccColorProfile *lcmsProfile = static_cast<KoIccColorProfile *>(colorSpace->profile());
const KoIccColorProfile *lcmsProfile = static_cast<const KoIccColorProfile *>(colorSpace->profile());
LPGAMMATABLE redGamma = cmsReadICCGamma(lcmsProfile->asLcms()->lcmsProfile(), icSigRedTRCTag);
......@@ -247,7 +247,7 @@ template <class ColorSpaceTraits>
void KisRgbFloatHDRColorSpaceTest::testChannels(const QString &colorSpaceId,
const KoChannelInfo::enumChannelValueType channelValueType)
{
KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId, 0);
const KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId, 0);
QVERIFY(colorSpace != 0);
QList<KoChannelInfo*> channels = colorSpace->channels();
......
......@@ -67,7 +67,7 @@ class KisLabToXyzColorConversionTransformationFactory : public KoColorConversion
public:
KisLabToXyzColorConversionTransformationFactory(QString _dstDepthId) : KoColorConversionTransformationFactory(LABAColorModelID.id(), Integer16BitsColorDepthID.id(), XYZAColorModelID.id(), _dstDepthId)
{}
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual)
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual) const
{
Q_UNUSED(renderingIntent);
Q_ASSERT(canBeSource(srcColorSpace));
......
......@@ -48,7 +48,7 @@ class KisRgbToXyzColorConversionTransformationFactory : public KoColorConversion
public:
KisRgbToXyzColorConversionTransformationFactory(QString _srcDepthId, QString _dstDepthId) : KoColorConversionTransformationFactory(RGBAColorModelID.id(), _srcDepthId, XYZAColorModelID.id(), _dstDepthId)
{}
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual)
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual) const
{
Q_UNUSED(renderingIntent);
Q_ASSERT(canBeSource(srcColorSpace));
......
......@@ -69,7 +69,7 @@ public:
}
virtual KoColorSpace *createColorSpace(KoColorSpaceRegistry * parent, KoColorProfile * p) const { return new KisXyzF32HDRColorSpace(parent, p); }
virtual bool profileIsCompatible(KoColorProfile* profile) const
virtual bool profileIsCompatible(const KoColorProfile* profile) const
{
return profile == 0;
}
......
......@@ -76,7 +76,7 @@ class KisXyzFloatHDRColorSpace : public KoIncompleteColorSpace<_CSTraits>
}
public:
virtual bool profileIsCompatible(KoColorProfile* profile) const
virtual bool profileIsCompatible(const KoColorProfile* profile) const
{
return profile == 0;
}
......
......@@ -67,7 +67,7 @@ class KisXyzToLabColorConversionTransformationFactory : public KoColorConversion
public:
KisXyzToLabColorConversionTransformationFactory(QString _srcDepthId) : KoColorConversionTransformationFactory(XYZAColorModelID.id(), _srcDepthId, LABAColorModelID.id(), Integer16BitsColorDepthID.id())
{}
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual)
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual) const
{
Q_UNUSED(renderingIntent);
Q_ASSERT(canBeSource(srcColorSpace));
......
......@@ -49,7 +49,7 @@ class KisXyzToRgbColorConversionTransformationFactory : public KoColorConversion
public:
KisXyzToRgbColorConversionTransformationFactory(QString _srcDepthId, QString _dstDepthId) : KoColorConversionTransformationFactory(XYZAColorModelID.id(), _srcDepthId, RGBAColorModelID.id(), _dstDepthId)
{}
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual)
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual) const
{
Q_UNUSED(renderingIntent);
Q_ASSERT(canBeSource(srcColorSpace));
......
......@@ -53,7 +53,7 @@ class KisRgbToYCbCrColorConversionTransformationFactory : public KoColorConversi
public:
KisRgbToYCbCrColorConversionTransformationFactory(QString _srcColorModelId, QString _srcDepthId, QString _dstColorModelId, QString _dstDepthId) : KoColorConversionTransformationFactory(_srcColorModelId, _srcDepthId, _dstColorModelId, _dstDepthId)
{}
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual)
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual) const
{
Q_UNUSED(renderingIntent);
Q_ASSERT(canBeSource(srcColorSpace));
......
......@@ -38,11 +38,11 @@ class KisYCbCrBaseColorSpace : public KoIncompleteColorSpace<_CSTraits>
}
virtual bool profileIsCompatible(KoColorProfile* /*profile*/) const
virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const
{
return false;
}
virtual void fromQColor(const QColor& c, quint8 *dstU8, KoColorProfile * /*profile*/) const
virtual void fromQColor(const QColor& c, quint8 *dstU8, const KoColorProfile * /*profile*/) const
{
typename _CSTraits::Pixel *dst = reinterpret_cast< typename _CSTraits::Pixel *>(dstU8);
typename _CSTraits::channels_type red = UINT8_TO_NATIVE(c.red());
......@@ -53,7 +53,7 @@ class KisYCbCrBaseColorSpace : public KoIncompleteColorSpace<_CSTraits>
dst->Cr = _CSTraits::computeCr( red, green, blue);
}
virtual void fromQColor(const QColor& c, quint8 opacity, quint8 *dstU8, KoColorProfile * /*profile*/) const
virtual void fromQColor(const QColor& c, quint8 opacity, quint8 *dstU8, const KoColorProfile * /*profile*/) const
{
typename _CSTraits::Pixel *dst = reinterpret_cast<typename _CSTraits::Pixel *>(dstU8);
typename _CSTraits::channels_type red = UINT8_TO_NATIVE(c.red());
......@@ -65,7 +65,7 @@ class KisYCbCrBaseColorSpace : public KoIncompleteColorSpace<_CSTraits>
dst->alpha = UINT8_TO_NATIVE(opacity);
}
virtual void toQColor(const quint8 *srcU8, QColor *c, KoColorProfile * /*profile*/) const
virtual void toQColor(const quint8 *srcU8, QColor *c, const KoColorProfile * /*profile*/) const
{
const typename _CSTraits::Pixel* src = reinterpret_cast<const typename _CSTraits::Pixel *>(srcU8);
c->setRgb(
......@@ -74,7 +74,7 @@ class KisYCbCrBaseColorSpace : public KoIncompleteColorSpace<_CSTraits>
NATIVE_TO_UINT8(_CSTraits::computeBlue( src->Y, src->Cb, src->Cr) ) );
}
virtual void toQColor(const quint8 *srcU8, QColor *c, quint8 *opacity, KoColorProfile * /*profile*/) const
virtual void toQColor(const quint8 *srcU8, QColor *c, quint8 *opacity, const KoColorProfile * /*profile*/) const
{
const typename _CSTraits::Pixel* src = reinterpret_cast<const typename _CSTraits::Pixel *>(srcU8);
c->setRgb(
......
......@@ -50,7 +50,7 @@ class KisYCbCrToRgbColorConversionTransformationFactory : public KoColorConversi
public:
KisYCbCrToRgbColorConversionTransformationFactory(QString _srcColorModelId, QString _srcDepthId, QString _dstColorModelId, QString _dstDepthId) : KoColorConversionTransformationFactory(_srcColorModelId, _srcDepthId, _dstColorModelId, _dstDepthId)
{}
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual)
virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::IntentPerceptual) const
{
Q_UNUSED(renderingIntent);
Q_ASSERT(canBeSource(srcColorSpace));
......
......@@ -49,7 +49,7 @@ public:
virtual KoID colorDepthId() const { return Integer16BitsColorDepthID; }
virtual bool userVisible() const { return true; }
virtual bool profileIsCompatible(KoColorProfile* /*profile*/) const
virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const
{
return false;
}
......
......@@ -46,7 +46,7 @@ public:
virtual KoID colorDepthId() const { return Integer8BitsColorDepthID; }
virtual bool userVisible() const { return true; }
virtual bool profileIsCompatible(KoColorProfile* /*profile*/) const
virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const
{
return false;
}
......
......@@ -152,7 +152,7 @@ KisSelectionSP KisAdjustmentLayer::selection() const
void KisAdjustmentLayer::setSelection(KisSelectionSP selection)
{
m_d->selection = new KisSelection();
KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisFillPainter gc(KisPaintDeviceSP(m_d->selection.data()));
......
......@@ -36,7 +36,7 @@ void KisBoundary::generateBoundary(int w, int h) {
if (!m_device)
return;
KoColorSpace* cs = m_device->colorSpace();
const KoColorSpace* cs = m_device->colorSpace();
// Horizontal
for (int currentY = - 1; currentY < h; currentY++) {
......
......@@ -415,7 +415,7 @@ KisQImagemaskSP KisBrush::mask(const KisPaintInformation& info, double subPixelX
return outputMask;
}
KisPaintDeviceSP KisBrush::image(KoColorSpace * /*colorSpace*/, const KisPaintInformation& info, double subPixelX, double subPixelY) const
KisPaintDeviceSP KisBrush::image(const KoColorSpace * /*colorSpace*/, const KisPaintInformation& info, double subPixelX, double subPixelY) const
{
if (m_scaledBrushes.isEmpty()) {
createScaledBrushes();
......@@ -1262,7 +1262,7 @@ void KisBrush::generateBoundary() {
dev = image(KoColorSpaceRegistry::instance()->colorSpace("RGBA",0), KisPaintInformation());
} else {
KisQImagemaskSP amask = mask(KisPaintInformation());
KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace("RGBA",0);
const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace("RGBA",0);
dev = new KisPaintDevice(cs, "tmp for generateBoundary");
KisHLineIteratorPixel it = dev->createHLineIterator(0, 0, w);
......
......@@ -85,7 +85,7 @@ public:
virtual KisQImagemaskSP mask(const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0) const;
// XXX: return non-tiled simple buffer
virtual KisPaintDeviceSP image(KoColorSpace * colorSpace, const KisPaintInformation& info,
virtual KisPaintDeviceSP image(const KoColorSpace * colorSpace, const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0) const;
void setHotSpot(QPointF);
......
......@@ -36,7 +36,7 @@
*/
class KisChangeProfileVisitor :public KisNodeVisitor {
public:
KisChangeProfileVisitor(KoColorSpace *oldColorSpace, KoColorSpace *dstColorSpace);
KisChangeProfileVisitor(const KoColorSpace *oldColorSpace, const KoColorSpace *dstColorSpace);
virtual ~KisChangeProfileVisitor();
public:
......@@ -50,12 +50,12 @@ public:
bool visit(KisAdjustmentLayer* layer);
private:
KoColorSpace *m_oldColorSpace;
KoColorSpace *m_dstColorSpace;
const KoColorSpace *m_oldColorSpace;
const KoColorSpace *m_dstColorSpace;
};
KisChangeProfileVisitor::KisChangeProfileVisitor(KoColorSpace * oldColorSpace,
KoColorSpace *dstColorSpace) :
KisChangeProfileVisitor::KisChangeProfileVisitor(const KoColorSpace * oldColorSpace,
const KoColorSpace *dstColorSpace) :
KisNodeVisitor(),
m_oldColorSpace(oldColorSpace),
m_dstColorSpace(dstColorSpace)
......@@ -86,7 +86,7 @@ bool KisChangeProfileVisitor::visit(KisPaintLayer *layer)
if (!layer->paintDevice()) return false;
if (!layer->paintDevice()->colorSpace()) return false;
KoColorSpace * cs = layer->paintDevice()->colorSpace();
const KoColorSpace * cs = layer->paintDevice()->colorSpace();
if (cs == m_oldColorSpace) {
......
......@@ -113,7 +113,7 @@ namespace {
class KoColorSpaceConvertVisitor :public KisNodeVisitor {
public:
KoColorSpaceConvertVisitor(KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent);
KoColorSpaceConvertVisitor(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent);
virtual ~KoColorSpaceConvertVisitor();
public:
......@@ -128,12 +128,12 @@ public:
bool visit(KisAdjustmentLayer* layer);
private:
KoColorSpace *m_dstColorSpace;
const KoColorSpace *m_dstColorSpace;
KoColorConversionTransformation::Intent m_renderingIntent;
QBitArray m_emptyChannelFlags;
};
KoColorSpaceConvertVisitor::KoColorSpaceConvertVisitor(KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent) :
KoColorSpaceConvertVisitor::KoColorSpaceConvertVisitor(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent) :
KisNodeVisitor(),
m_dstColorSpace(dstColorSpace),
m_renderingIntent(renderingIntent)
......
......@@ -47,7 +47,7 @@ const PropertyCell hardDefault = {
const double DEFAULT_SCALE = 1.0;
KisComplexColor::KisComplexColor(KoColorSpace *colorSpace)
KisComplexColor::KisComplexColor(const KoColorSpace *colorSpace)
: KisPaintDevice(colorSpace)
{
m_scaling = DEFAULT_SCALE;
......@@ -58,7 +58,7 @@ KisComplexColor::KisComplexColor(KoColorSpace *colorSpace)
fromKoColor(kc);
}
KisComplexColor::KisComplexColor(KoColorSpace *colorSpace, const KoColor &kc)
KisComplexColor::KisComplexColor(const KoColorSpace *colorSpace, const KoColor &kc)
: KisPaintDevice(colorSpace)
{
m_scaling = DEFAULT_SCALE;
......
......@@ -37,8 +37,8 @@ class KRITAIMAGE_EXPORT KisComplexColor : public KisPaintDevice {
public:
KisComplexColor(KoColorSpace *colorSpace);
KisComplexColor(KoColorSpace *colorSpace, const KoColor &kc);
KisComplexColor(const KoColorSpace *colorSpace);
KisComplexColor(const KoColorSpace *colorSpace, const KoColor &kc);
~KisComplexColor();
void fromKoColor(const KoColor &kc);
......
......@@ -119,7 +119,7 @@ void KisConvolutionPainter::applyMatrix(KisKernelSP kernel, qint32 x, qint32 y,
int lastProgressPercent = 0;
if (m_progressUpdater) m_progressUpdater->setProgress(0);
KoColorSpace * cs = m_device->colorSpace();
const KoColorSpace * cs = m_device->colorSpace();
KoConvolutionOp * convolutionOp = cs->convolutionOp();
// Determine whether we convolve border pixels, or not.
......@@ -247,7 +247,7 @@ void KisConvolutionPainter::applyMatrixRepeat( KisKernelSP kernel, qint32 x, qin
xLastMinuskhw = x + (w - khalfWidth);
yLastMinuskhh = y + (h - khalfHeight);
KoColorSpace * cs = m_device->colorSpace();
const KoColorSpace * cs = m_device->colorSpace();
KoConvolutionOp * convolutionOp = cs->convolutionOp();
// Iterate over all pixels in our rect, create a cache of pixels around the current pixel and convolve them in the colorspace.
......
......@@ -242,8 +242,8 @@ KisPixelSelectionSP KisFillPainter::createFloodSelection(int startX, int startY,
m_size = m_width * m_height;
KisPixelSelectionSP selection = KisPixelSelectionSP(new KisPixelSelection(m_device));
KoColorSpace * colorSpace = selection->colorSpace();
KoColorSpace * devColorSpace = sourceDevice->colorSpace();
const KoColorSpace * colorSpace = selection->colorSpace();
const KoColorSpace * devColorSpace = sourceDevice->colorSpace();
quint8* source = new quint8[sourceDevice->pixelSize()];
KisHLineConstIteratorPixel pixelIt = sourceDevice->createHLineConstIterator(startX, startY, startX+1);
......
......@@ -212,7 +212,7 @@ void KisFillPainter::fillRect(const QRect& rc, const KoColor& c)
inline
void KisFillPainter::eraseRect(qint32 x1, qint32 y1, qint32 w, qint32 h)
{
KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor c(Qt::black, cs);
fillRect(x1, y1, w, h, c, OPACITY_TRANSPARENT);
}
......@@ -220,7 +220,7 @@ void KisFillPainter::eraseRect(qint32 x1, qint32 y1, qint32 w, qint32 h)
inline
void KisFillPainter::eraseRect(const QRect& rc)
{
KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor c(Qt::black, cs);
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_TRANSPARENT);
}
......
......@@ -143,7 +143,7 @@ public:
*
* @param cs the colorspace that we want to know this filter works with
*/
virtual bool workWith(KoColorSpace* cs) const { Q_UNUSED(cs); return true; }
virtual bool workWith(const KoColorSpace* cs) const { Q_UNUSED(cs); return true; }
/// @return Unique identification for this filter
QString id() const;
......
......@@ -80,7 +80,7 @@ class KisGenericColorspace : public KoColorSpace {
public:
virtual KoID colorModelId() const { return KoID("",""); }
virtual KoID colorDepthId() const { return KoID("",""); }
virtual bool profileIsCompatible(KoColorProfile* profile) const {return false;}
virtual bool profileIsCompatible(const KoColorProfile* profile) const {return false;}
//========== Channels =====================================================//
......@@ -95,7 +95,7 @@ class KisGenericColorspace : public KoColorSpace {
virtual quint32 pixelSize() const { return _nbchannels * sizeof(_type); }
virtual KoColorProfile * profile() const { return 0; }
virtual const KoColorProfile * profile() const { return 0; }
virtual bool willDegrade(ColorSpaceIndependence ) const {return true;}
......@@ -103,7 +103,7 @@ class KisGenericColorspace : public KoColorSpace {
virtual QString normalisedChannelValueText(const quint8 */*pixel*/, quint32 /*channelIndex*/) const { return "invalid"; };
virtual void normalisedChannelsValue(const quint8 *pixel, QVector<float> &channels) const { return; }
virtual void fromNormalisedChannelsValue(quint8 *pixel, const QVector<float> &values) { return; }
virtual void fromNormalisedChannelsValue(quint8 *pixel, const QVector<float> &values) const { return; }
virtual quint8 scaleToU8(const quint8 * /*srcPixel*/, qint32 /*channelPos*/) const { return 0; }
......@@ -117,20 +117,18 @@ class KisGenericColorspace : public KoColorSpace {
virtual bool hasHighDynamicRange() const { return false; }
virtual KoColorProfile * getProfile() const { return 0; }
virtual void fromQColor(const QColor& /*c*/, quint8 */*dst*/, const KoColorProfile */* profile = 0*/) const { }
virtual void fromQColor(const QColor& /*c*/, quint8 */*dst*/, KoColorProfile */* profile = 0*/) const { }
virtual void fromQColor(const QColor& /*c*/, quint8 /*opacity*/, quint8 */*dst*/, const KoColorProfile * /*profile = 0*/) const { }
virtual void fromQColor(const QColor& /*c*/, quint8 /*opacity*/, quint8 */*dst*/, KoColorProfile * /*profile = 0*/) const { }
virtual void toQColor(const quint8 */*src*/, QColor */*c*/, const KoColorProfile * /*profile = 0*/) const { }
virtual void toQColor(const quint8 */*src*/, QColor */*c*/, KoColorProfile * /*profile = 0*/) const { }
virtual void toQColor(const quint8 */*src*/, QColor */*c*/, quint8 */*opacity*/, KoColorProfile * /*profile = 0*/) const { }
virtual void toQColor(const quint8 */*src*/, QColor */*c*/, quint8 */*opacity*/, const KoColorProfile * /*profile = 0*/) const { }
virtual void singleChannelPixel(quint8 *, const quint8 *, quint32 ) const {}
virtual QImage convertToQImage(const quint8 */*data*/, qint32 /*width*/, qint32 /*height*/,
KoColorProfile * /*dstProfile*/, KoColorConversionTransformation::Intent /*renderingIntent = INTENT_PERCEPTUAL*/,
const KoColorProfile * /*dstProfile*/, KoColorConversionTransformation::Intent /*renderingIntent = INTENT_PERCEPTUAL*/,
float /*exposure = 0.0f*/) const { return QImage(); }
virtual void toLabA16(const quint8 * /*src*/, quint8 * /*dst*/, const quint32 /*nPixels*/) const { }
......
......@@ -87,7 +87,7 @@ bool KisGroupLayer::allowAsChild( KisNodeSP node)
}
KoColorSpace * KisGroupLayer::colorSpace()
const KoColorSpace * KisGroupLayer::colorSpace()
{
// Due to virtual void resetProjection(KisPaintDeviceSP to =
// 0), the colorspace of the group layer can be different from the
......
......@@ -72,7 +72,7 @@ public:
* resulting in a grayscale projection that is then merged with an
* rgb image stack.
*/
KoColorSpace * colorSpace();
const KoColorSpace * colorSpace();
/**
Return the united extents of all layers in this group layer;
......
......@@ -64,7 +64,7 @@ void KisHistogram::updateHistogram()
QRect r;
r = m_dev->exactBounds();
KisRectConstIteratorPixel srcIt = m_dev->createRectConstIterator(r.x(), r.y(), r.width(), r.height());
KoColorSpace* cs = m_dev->colorSpace();
const KoColorSpace* cs = m_dev->colorSpace();
QTime t;
t.start();
......
......@@ -87,7 +87,7 @@ public:
KoUnit unit;
KoColorSpace * colorSpace;
const KoColorSpace * colorSpace;
KisGroupLayerSP rootLayer; // The layers are contained in here
QList<KisLayer*> dirtyLayers; // for thumbnails
......@@ -107,7 +107,7 @@ public:
KisImage::KisImage(KisUndoAdapter *adapter, qint32 width, qint32 height, KoColorSpace * colorSpace, const QString& name)
KisImage::KisImage(KisUndoAdapter *adapter, qint32 width, qint32 height, const KoColorSpace * colorSpace, const QString& name)
: QObject(0)
, KisShared()
, m_d( new KisImagePrivate() )
......@@ -287,7 +287,7 @@ void KisImage::rollBackLayerName()
m_d->nserver->rollback();
}
void KisImage::init(KisUndoAdapter *adapter, qint32 width, qint32 height, KoColorSpace * colorSpace)
void KisImage::init(KisUndoAdapter *adapter, qint32 width, qint32 height, const KoColorSpace * colorSpace)
{
if (colorSpace == 0) {
colorSpace = KoColorSpaceRegistry::instance()->rgb8();
......@@ -562,7 +562,7 @@ void KisImage::shear(double angleX, double angleY, KoUpdater *progress)
}
}
void KisImage::convertTo(KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent)
void KisImage::convertTo(const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent)
{
if ( m_d->colorSpace == dstColorSpace )
{
......@@ -571,7 +571,7 @@ void KisImage::convertTo(KoColorSpace * dstColorSpace, KoColorConversionTransfor
lock();
KoColorSpace * oldCs = m_d->colorSpace;
const KoColorSpace * oldCs = m_d->colorSpace;
if (undo()) {
m_d->adapter->beginMacro(i18n("Convert Image Type"));
......@@ -593,7 +593,7 @@ void KisImage::convertTo(KoColorSpace * dstColorSpace, KoColorConversionTransfor
}
}
KoColorProfile * KisImage::profile() const
const KoColorProfile * KisImage::profile() const
{
return colorSpace()->profile();
}
......@@ -602,13 +602,13 @@ void KisImage::setProfile(const KoColorProfile * profile)
{
if (profile == 0) return;
KoColorSpace * dstCs= KoColorSpaceRegistry::instance()->colorSpace( colorSpace()->id(),
const KoColorSpace * dstCs= KoColorSpaceRegistry::instance()->colorSpace( colorSpace()->id(),
profile);
if (dstCs) {
lock();
KoColorSpace * oldCs = colorSpace();
const KoColorSpace * oldCs = colorSpace();
setColorSpace(dstCs);
emit(sigProfileChanged(const_cast<KoColorProfile *>(profile)));
......@@ -1066,12 +1066,12 @@ void KisImage::slotSelectionChanged(const QRect& r)
}
}
KoColorSpace * KisImage::colorSpace() const
const KoColorSpace * KisImage::colorSpace() const
{
return m_d->colorSpace;
}
void KisImage::setColorSpace(KoColorSpace * colorSpace)
void KisImage::setColorSpace(const KoColorSpace * colorSpace)
{
m_d->colorSpace = colorSpace;
m_d->rootLayer->resetProjection();
......@@ -1128,7 +1128,7 @@ void KisImage::removeAnnotation(const QString& type)
vKisAnnotationSP_it KisImage::beginAnnotations()
{