Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a8c01ff9 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix color management of the display

BUG:285382

We took the display profile from the kritarc config file, which when it's
set by colord or anything else wrong. So make sure that it's easy to get
the correct colorprofile and use that everywhere.
parent 22c649d0
......@@ -149,7 +149,7 @@ void KisPainterBenchmark::benchmarkFixedBitBlt()
img.fill(255);
KisFixedPaintDeviceSP fdev = new KisFixedPaintDevice(m_colorSpace);
fdev->convertFromQImage(img, "");
fdev->convertFromQImage(img, 0);
KisPaintDeviceSP dst = new KisPaintDevice(m_colorSpace);
KisPainter gc(dst);
......@@ -170,7 +170,7 @@ void KisPainterBenchmark::benchmarkFixedBitBltSelection()
img.fill(128);
KisFixedPaintDeviceSP fdev = new KisFixedPaintDevice(m_colorSpace);
fdev->convertFromQImage(img, "");
fdev->convertFromQImage(img, 0);
KisPaintDeviceSP dst = new KisPaintDevice(m_colorSpace);
......
......@@ -112,7 +112,7 @@ public:
/**
* Fill this paint device with the data from image
*
* @param srcProfileName name of the RGB profile to interpret the image as. "" is interpreted as sRGB
* @param srcProfileName name of the RGB profile to interpret the image as. 0 is interpreted as sRGB
*/
virtual void convertFromQImage(const QImage& image, const QString &srcProfileName);
......
......@@ -646,7 +646,7 @@ void KisPaintDevice::setDataManager(KisDataManagerSP data, const KoColorSpace *
}
}
void KisPaintDevice::convertFromQImage(const QImage& _image, const QString &srcProfileName,
void KisPaintDevice::convertFromQImage(const QImage& _image, const KoColorProfile *profile,
qint32 offsetX, qint32 offsetY)
{
QImage image = _image;
......@@ -655,12 +655,13 @@ void KisPaintDevice::convertFromQImage(const QImage& _image, const QString &srcP
image = image.convertToFormat(QImage::Format_ARGB32);
}
// Don't convert if not no profile is given and both paint dev and qimage are rgba.
if (srcProfileName.isEmpty() && colorSpace()->id() == "RGBA") {
if (!profile && colorSpace()->id() == "RGBA") {
writeBytes(image.bits(), offsetX, offsetY, image.width(), image.height());
} else {
Q_ASSERT(profile);
quint8 * dstData = new quint8[image.width() * image.height() * pixelSize()];
KoColorSpaceRegistry::instance()
->colorSpace(RGBAColorModelID.id(), Integer8BitsColorDepthID.id(), srcProfileName)
->colorSpace(RGBAColorModelID.id(), Integer8BitsColorDepthID.id(), profile)
->convertPixelsTo(image.bits(), dstData, colorSpace(), image.width() * image.height());
writeBytes(dstData, offsetX, offsetY, image.width(), image.height());
......@@ -669,7 +670,7 @@ void KisPaintDevice::convertFromQImage(const QImage& _image, const QString &srcP
m_d->cache.invalidate();
}
QImage KisPaintDevice::convertToQImage(const KoColorProfile * dstProfile) const
QImage KisPaintDevice::convertToQImage(const KoColorProfile *dstProfile) const
{
qint32 x1;
qint32 y1;
......
......@@ -409,9 +409,9 @@ public:
/**
* Fill this paint device with the data from image; starting at (offsetX, offsetY)
* @param srcProfileName name of the RGB profile to interpret the image as. "" is interpreted as sRGB
* @param srcProfileName name of the RGB profile to interpret the image as. 0 is interpreted as sRGB
*/
virtual void convertFromQImage(const QImage& image, const QString &srcProfileName, qint32 offsetX = 0, qint32 offsetY = 0);
virtual void convertFromQImage(const QImage& image, const KoColorProfile *profile, qint32 offsetX = 0, qint32 offsetY = 0);
/**
* Create an RGBA QImage from a rectangle in the paint device.
......@@ -424,7 +424,7 @@ public:
* case it's up to the color strategy to choose a profile (most
* like sRGB).
*/
virtual QImage convertToQImage(const KoColorProfile * dstProfile, qint32 x, qint32 y, qint32 w, qint32 h) const;
virtual QImage convertToQImage(const KoColorProfile *dstProfile, qint32 x, qint32 y, qint32 w, qint32 h) const;
/**
* Create an RGBA QImage from a rectangle in the paint device. The
......
......@@ -50,7 +50,7 @@ KisPattern::KisPattern(const QString& file)
}
KisPattern::KisPattern(const QImage &image, const QString &name)
: KoPattern("")
: KoPattern(0)
{
setImage(image);
setName(name);
......@@ -63,7 +63,7 @@ KisPattern::~KisPattern()
KisPaintDeviceSP KisPattern::paintDevice(const KoColorSpace * colorSpace) const
{
KisPaintDevice* dev = new KisPaintDevice(colorSpace, name());
dev->convertFromQImage(image(), "");
dev->convertFromQImage(image(), 0);
return dev;
}
......
......@@ -59,8 +59,8 @@ void KisAsyncMergerTest::testMerger()
KisPaintDeviceSP device1 = new KisPaintDevice(colorSpace);
KisPaintDeviceSP device2 = new KisPaintDevice(colorSpace);
device1->convertFromQImage(sourceImage1, "", 0, 0);
device2->convertFromQImage(sourceImage2, "", 0, 0);
device1->convertFromQImage(sourceImage1, 0, 0, 0);
device2->convertFromQImage(sourceImage2, 0, 0, 0);
KisFilterSP filter = KisFilterRegistry::instance()->value("blur");
Q_ASSERT(filter);
......@@ -144,7 +144,7 @@ void KisAsyncMergerTest::debugObligeChild()
QImage sourceImage1(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
KisPaintDeviceSP device1 = new KisPaintDevice(colorSpace);
device1->convertFromQImage(sourceImage1, "", 0, 0);
device1->convertFromQImage(sourceImage1, 0, 0, 0);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, device1);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
......
......@@ -114,7 +114,7 @@ void KisConvolutionPainterTest::testIdentityConvolution()
QImage qimage(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
KisPaintDeviceSP dev = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
dev->convertFromQImage(qimage, "", 0, 0);
dev->convertFromQImage(qimage, 0, 0, 0);
KisConvolutionKernelSP kernel = new KisConvolutionKernel(3, 3, 0, 0);
kernel->data()[0] = 0;
......@@ -127,7 +127,7 @@ void KisConvolutionPainterTest::testIdentityConvolution()
kernel->data()[7] = 0;
kernel->data()[8] = 0;
KisConvolutionPainter gc(dev);
gc.beginTransaction("");
gc.beginTransaction(0);
gc.applyMatrix(kernel, dev, QPoint(0, 0), QPoint(0, 0), QSize(qimage.width(), qimage.height()));
gc.deleteTransaction();
......@@ -155,7 +155,7 @@ void KisConvolutionPainterTest::testSymmConvolution()
KisConvolutionKernelSP kernel =
KisConvolutionKernel::fromMatrix(filter, offset, factor);
KisConvolutionPainter gc(dev);
gc.beginTransaction("");
gc.beginTransaction(0);
gc.applyMatrix(kernel, dev, imageRect.topLeft(), imageRect.topLeft(),
imageRect.size());
gc.deleteTransaction();
......@@ -176,11 +176,11 @@ void KisConvolutionPainterTest::testAsymmConvolutionImp(QBitArray channelFlags)
int pixelSize = -1;
QByteArray initialData;
KisPaintDeviceSP dev = initAsymTestDevice(imageRect, pixelSize, initialData);
KisConvolutionKernelSP kernel =
KisConvolutionKernel::fromMatrix(filter, offset, factor);
KisConvolutionPainter gc(dev);
gc.beginTransaction("");
gc.beginTransaction(0);
gc.setChannelFlags(channelFlags);
gc.applyMatrix(kernel, dev, imageRect.topLeft(), imageRect.topLeft(),
imageRect.size());
......@@ -206,7 +206,7 @@ void KisConvolutionPainterTest::testAsymmConvolutionImp(QBitArray channelFlags)
referencePixel.data()[j] = isFiltered && channelFlags[j] ?
filteredPixel.data()[j] : srcPtr[j];
}
if(memcmp(resPtr, referencePixel.data(), pixelSize)) {
printPixel("Actual: ", pixelSize, resPtr);
printPixel("Expected:", pixelSize, referencePixel.data());
......@@ -270,7 +270,7 @@ void KisConvolutionPainterTest::benchmarkConvolution()
QRect imageRect(QPoint(), referenceImage.size());
KisPaintDeviceSP dev = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
dev->convertFromQImage(referenceImage, "", 0, 0);
dev->convertFromQImage(referenceImage, 0, 0, 0);
qreal offset = 0.0;
qreal factor = 1.0;
......@@ -289,7 +289,7 @@ void KisConvolutionPainterTest::benchmarkConvolution()
// CALLGRIND_START_INSTRUMENTATION;
gc.beginTransaction("");
gc.beginTransaction(0);
gc.applyMatrix(kernel, dev, imageRect.topLeft(), imageRect.topLeft(),
imageRect.size());
gc.deleteTransaction();
......
......@@ -70,7 +70,7 @@ void KisCsConversionTest::testColorSpaceConversion()
foreach(const KoColorSpace * dstCs, colorSpaces) {
KisPaintDeviceSP dev = new KisPaintDevice(srcCs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
dev->move(10, 10); // Unalign with tile boundaries
dev->convertTo(dstCs);
......
......@@ -71,7 +71,7 @@ void KisFilterJobTest::testInWeaver()
QImage qimage(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
QImage inverted(QString(FILES_DATA_DIR) + QDir::separator() + "inverted_hakonepa.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(qimage, "", 0, 0);
dev->convertFromQImage(qimage, 0, 0, 0);
KisFilterJobFactory factory(f, kfc);
......
......@@ -44,7 +44,7 @@ void KisFilterMaskTest::testCreation()
#define initImage(image, layer, device, mask) do { \
image = new KisImage(0, IMAGE_WIDTH, IMAGE_HEIGHT, 0, "tests"); \
layer = new KisPaintLayer(image, "", 100, device); \
layer = new KisPaintLayer(image, 0, 100, device); \
image->addNode(layer); \
image->addNode(mask, layer); \
} while(0)
......
......@@ -146,7 +146,7 @@ void KisFilterSelectionsBenchmark::testAll()
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
m_device = new KisPaintDevice(cs);
m_device->convertFromQImage(image, "", 0, 0);
m_device->convertFromQImage(image, 0, 0, 0);
testFilter("brightnesscontrast");
testFilter("invert");
......@@ -166,7 +166,7 @@ void KisFilterSelectionsBenchmark::testUsualSelections(int num)
timer.restart();
for (int i = 0; i < num; i++) {
KisTransaction transac("", projection, 0);
KisTransaction transac(0, projection, 0);
m_filter->process(m_device, projection, m_selection, filterRect, m_configuration, 0);
}
avTime = double(timer.elapsed()) / num;
......@@ -189,7 +189,7 @@ void KisFilterSelectionsBenchmark::testNoSelections(int num)
timer.restart();
for (int i = 0; i < num; i++) {
KisTransaction transac("", projection, 0);
KisTransaction transac(0, projection, 0);
m_filter->process(m_device, projection, 0, filterRect, m_configuration, 0);
}
avTime = double(timer.elapsed()) / num;
......@@ -215,7 +215,7 @@ void KisFilterSelectionsBenchmark::testGoodSelections(int num)
timer.restart();
for (int i = 0; i < num; i++) {
KisTransaction transac("", projection, 0);
KisTransaction transac(0, projection, 0);
m_filter->processSpecial(src, dst, filterRect.size(), m_configuration, 0);
}
avTime = double(timer.elapsed()) / num;
......@@ -244,11 +244,11 @@ void KisFilterSelectionsBenchmark::testBitBltWOSelections(int num)
for (int i = 0; i < num; i++) {
KisPaintDeviceSP cacheDevice = new KisPaintDevice(projection->colorSpace());
KisTransaction transac("", cacheDevice, 0);
KisTransaction transac(0, cacheDevice, 0);
m_filter->process(m_device, projection, 0, filterRect, m_configuration, 0);
KisPainter painter(projection);
painter.beginTransaction("");
painter.beginTransaction(0);
painter.setCompositeOp(projection->colorSpace()->compositeOp(COMPOSITE_ALPHA_DARKEN));
painter.bitBlt(filterRect.topLeft(), cacheDevice, filterRect);
painter.deleteTransaction();
......@@ -275,11 +275,11 @@ void KisFilterSelectionsBenchmark::testBitBltSelections(int num)
for (int i = 0; i < num; i++) {
KisPaintDeviceSP cacheDevice = new KisPaintDevice(projection->colorSpace());
KisTransaction transac("", cacheDevice, 0);
KisTransaction transac(0, cacheDevice, 0);
m_filter->process(m_device, cacheDevice, 0, filterRect, m_configuration, 0);
KisPainter gc(projection);
gc.beginTransaction("");
gc.beginTransaction(0);
gc.setCompositeOp(projection->colorSpace()->compositeOp(COMPOSITE_ALPHA_DARKEN));
gc.setSelection(m_selection);
gc.bitBlt(filterRect.topLeft(), cacheDevice, filterRect);
......
......@@ -69,7 +69,7 @@ void KisFilterTest::testWithProgressUpdater()
QImage qimage(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
QImage inverted(QString(FILES_DATA_DIR) + QDir::separator() + "inverted_hakonepa.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(qimage, "", 0, 0);
dev->convertFromQImage(qimage, 0, 0, 0);
KisFilterSP f = KisFilterRegistry::instance()->value("invert");
Q_ASSERT(f);
......@@ -95,7 +95,7 @@ void KisFilterTest::testSingleThreaded()
QImage qimage(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
QImage inverted(QString(FILES_DATA_DIR) + QDir::separator() + "inverted_hakonepa.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(qimage, "", 0, 0);
dev->convertFromQImage(qimage, 0, 0, 0);
KisFilterSP f = KisFilterRegistry::instance()->value("invert");
Q_ASSERT(f);
......@@ -124,7 +124,7 @@ void KisFilterTest::testDifferentSrcAndDst()
sel->getOrCreatePixelSelection()->invert(); // select everything
sel->updateProjection();
src->convertFromQImage(qimage, "", 0, 0);
src->convertFromQImage(qimage, 0, 0, 0);
KisFilterSP f = KisFilterRegistry::instance()->value("invert");
Q_ASSERT(f);
......
......@@ -85,7 +85,7 @@ void KisFixedPaintDeviceTest::testColorSpaceConversion()
const KoColorSpace* srcCs = KoColorSpaceRegistry::instance()->rgb8();
const KoColorSpace* dstCs = KoColorSpaceRegistry::instance()->lab16();
KisFixedPaintDeviceSP dev = new KisFixedPaintDevice(srcCs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
dev->convertTo(dstCs);
......@@ -101,7 +101,7 @@ void KisFixedPaintDeviceTest::testRoundtripQImageConversion()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisFixedPaintDeviceSP dev = new KisFixedPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
QImage result = dev->convertToQImage(0, 0, 0, 640, 441);
QPoint errpoint;
......@@ -118,7 +118,7 @@ void KisFixedPaintDeviceTest::testBltFixed()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisFixedPaintDeviceSP fdev = new KisFixedPaintDevice(cs);
fdev->convertFromQImage(image, "");
fdev->convertFromQImage(image, 0);
// Without opacity
KisPaintDeviceSP dev = new KisPaintDevice(cs);
......@@ -144,7 +144,7 @@ void KisFixedPaintDeviceTest::testBltFixedOpacity()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa_transparent.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisFixedPaintDeviceSP fdev = new KisFixedPaintDevice(cs);
fdev->convertFromQImage(image, "");
fdev->convertFromQImage(image, 0);
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->fill(0, 0, 640, 441, KoColor(Qt::white, cs).data());
......@@ -220,7 +220,7 @@ void KisFixedPaintDeviceTest::testBltFixedSmall()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "fixed_blit_small.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisFixedPaintDeviceSP fdev = new KisFixedPaintDevice(cs);
fdev->convertFromQImage(image, "");
fdev->convertFromQImage(image, 0);
// Without opacity
KisPaintDeviceSP dev = new KisPaintDevice(cs);
......@@ -243,7 +243,7 @@ void KisFixedPaintDeviceTest::testBltPerformance()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa_transparent.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisFixedPaintDeviceSP fdev = new KisFixedPaintDevice(cs);
fdev->convertFromQImage(image, "");
fdev->convertFromQImage(image, 0);
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->fill(0, 0, 640, 441, KoColor(Qt::white, cs).data());
......
......@@ -202,7 +202,7 @@ void KisPaintDeviceTest::testRoundtripReadWrite()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = new KisPaintDevice(cs);
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "tile.png");
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
quint8* bytes = cs->allocPixelBuffer(image.width() * image.height());
memset(bytes, 0, image.width() * image.height() * dev->pixelSize());
dev->readBytes(bytes, image.rect());
......@@ -244,7 +244,7 @@ void KisPaintDeviceTest::testColorSpaceConversion()
const KoColorSpace* srcCs = KoColorSpaceRegistry::instance()->rgb8();
const KoColorSpace* dstCs = KoColorSpaceRegistry::instance()->lab16();
KisPaintDeviceSP dev = new KisPaintDevice(srcCs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
dev->move(10, 10); // Unalign with tile boundaries
KUndo2Command* cmd = dev->convertTo(dstCs);
......@@ -261,7 +261,7 @@ void KisPaintDeviceTest::testRoundtripConversion()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
QImage result = dev->convertToQImage(0, 0, 0, 640, 441);
QPoint errpoint;
......@@ -279,7 +279,7 @@ void KisPaintDeviceTest::testFastBitBlt()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dstDev = new KisPaintDevice(cs);
KisPaintDeviceSP srcDev = new KisPaintDevice(cs);
srcDev->convertFromQImage(image, "");
srcDev->convertFromQImage(image, 0);
QRect cloneRect(100,100,200,200);
QPoint errpoint;
......@@ -320,7 +320,7 @@ void KisPaintDeviceTest::testMakeClone()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP srcDev = new KisPaintDevice(cs);
srcDev->convertFromQImage(image, "");
srcDev->convertFromQImage(image, 0);
srcDev->move(10,10);
const KoColorSpace * weirdCS = KoColorSpaceRegistry::instance()->lab16();
......@@ -354,7 +354,7 @@ void KisPaintDeviceTest::testThumbnail()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
{
KisPaintDeviceSP thumb = dev->createThumbnailDevice(50, 50);
QRect rc = thumb->exactBounds();
......@@ -508,7 +508,7 @@ void KisPaintDeviceTest::testBltPerformance()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa_transparent.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP fdev = new KisPaintDevice(cs);
fdev->convertFromQImage(image, "");
fdev->convertFromQImage(image, 0);
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->fill(0, 0, 640, 441, KoColor(Qt::white, cs).data());
......@@ -548,7 +548,7 @@ void KisPaintDeviceTest::testDeviceDuplication()
referenceImage = device->convertToQImage(0);
KisTransaction transaction1("", device);
KisTransaction transaction1(0, device);
// qDebug()<<"CLEARING";
device->clear(clearRect);
......@@ -559,7 +559,7 @@ void KisPaintDeviceTest::testDeviceDuplication()
KisPaintDeviceSP clone = new KisPaintDevice(*device);
KisTransaction transaction("", clone);
KisTransaction transaction(0, clone);
// qDebug()<<"CLEARING";
clone->clear(clearRect);
......@@ -631,7 +631,7 @@ void KisPaintDeviceTest::testOpacity()
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa_transparent.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP fdev = new KisPaintDevice(cs);
fdev->convertFromQImage(image, "");
fdev->convertFromQImage(image, 0);
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->fill(0, 0, 640, 441, KoColor(Qt::white, cs).data());
......
......@@ -99,7 +99,7 @@ private:
blur1->setY(blurShift.y());
KisPaintLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8);
paintLayer1->paintDevice()->convertFromQImage(sourceImage, "", 0, 0);
paintLayer1->paintDevice()->convertFromQImage(sourceImage, 0, 0, 0);
KisTransparencyMaskSP transparencyMask1 = new KisTransparencyMask();
transparencyMask1->setName("tmask1");
......
......@@ -53,7 +53,7 @@ void KisTransformWorkerTest::testMirrorX()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev2 = new KisPaintDevice(cs);
dev2->convertFromQImage(image, "");
dev2->convertFromQImage(image, 0);
KisTransformWorker::mirrorX(dev2);
KisTransformWorker::mirrorX(dev2);
KisTransformWorker::mirrorX(dev2);
......@@ -76,7 +76,7 @@ void KisTransformWorkerTest::testMirrorY()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev2 = new KisPaintDevice(cs);
dev2->convertFromQImage(image, "");
dev2->convertFromQImage(image, 0);
KisTransformWorker::mirrorY(dev2);
KisTransformWorker::mirrorY(dev2);
KisTransformWorker::mirrorY(dev2);
......@@ -98,7 +98,7 @@ void KisTransformWorkerTest::testMirrorTransactionX()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev2 = new KisPaintDevice(cs);
dev2->convertFromQImage(image, "");
dev2->convertFromQImage(image, 0);
KisTransaction t("mirror", dev2);
KisTransformWorker::mirrorX(dev2);
......@@ -122,7 +122,7 @@ void KisTransformWorkerTest::testMirrorTransactionY()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev2 = new KisPaintDevice(cs);
dev2->convertFromQImage(image, "");
dev2->convertFromQImage(image, 0);
KisTransaction t("mirror", dev2);
KisTransformWorker::mirrorY(dev2);
......@@ -150,7 +150,7 @@ void KisTransformWorkerTest::testScaleUp()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
KisTransaction t("test", dev);
......@@ -187,7 +187,7 @@ void KisTransformWorkerTest::testXScaleUp()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
KisTransaction t("test", dev);
......@@ -223,7 +223,7 @@ void KisTransformWorkerTest::testYScaleUp()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
......@@ -260,7 +260,7 @@ void KisTransformWorkerTest::testIdentity()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
KisTransaction t("test", dev);
......@@ -295,7 +295,7 @@ void KisTransformWorkerTest::testScaleDown()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
KisTransaction t("test", dev);
......@@ -342,7 +342,7 @@ void KisTransformWorkerTest::testXScaleDown()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
......@@ -394,7 +394,7 @@ void KisTransformWorkerTest::testYScaleDown()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
KisTransaction t("test", dev);
......@@ -440,7 +440,7 @@ void KisTransformWorkerTest::testXShear()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
......@@ -488,7 +488,7 @@ void KisTransformWorkerTest::testYShear()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
......@@ -594,7 +594,7 @@ void KisTransformWorkerTest::testRotation()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "mirror_source.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, "");
dev->convertFromQImage(image, 0);
KisFilterStrategy * filter = new KisBoxFilterStrategy();
......
......@@ -50,8 +50,8 @@ KisImageSP KisUpdateSchedulerTest::buildTestingImage()
KisPaintLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8 / 3);
KisLayerSP blur1 = new KisAdjustmentLayer(image, "blur1", configuration, 0);
paintLayer1->paintDevice()->convertFromQImage(sourceImage1, "", 0, 0);
paintLayer2->paintDevice()->convertFromQImage(sourceImage2, "", 0, 0);
paintLayer1->paintDevice()->convertFromQImage(sourceImage1, 0, 0, 0);
paintLayer2->paintDevice()->convertFromQImage(sourceImage2, 0, 0, 0);
image->lock();
image->addNode(paintLayer1);
......
......@@ -82,7 +82,7 @@ void KisDropButton::dropEvent(QDropEvent *event)
QImage qimage = qvariant_cast<QImage>(event->mimeData()->imageData());
KisPaintDeviceSP device = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
device->convertFromQImage(qimage, "");
device->convertFromQImage(qimage, 0);
node = new KisPaintLayer(0, "node creaed from dropped image", OPACITY_OPAQUE_U8, device);
}
......
......@@ -60,13 +60,13 @@ MixerCanvas::MixerCanvas(QWidget *parent)
p.end();
KisConfig config;
const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(config.defaultPainterlyColorModelId(), config.defaultPainterlyColorDepthId(), "");
const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(config.defaultPainterlyColorModelId(), config.defaultPainterlyColorDepthId(), 0);
if (!cs) {
dbgPlugins << "Could not load painterly colorspace, falling back to rgb";
cs = KoColorSpaceRegistry::instance()->rgb16();
}
m_paintDevice = new KisPaintDevice(cs, "Mixer");
m_paintDevice->convertFromQImage(m_image, QString::null);
m_paintDevice->convertFromQImage(m_image, 0);
m_mixerTool = new MixerTool(this);
}
......
......@@ -67,7 +67,7 @@ bool testFilterSrcNotIsDev(KisFilterSP f)
QImage result(QString(FILES_DATA_DIR) + QDir::separator() + "lena_" + f->id() + ".png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
KisPaintDeviceSP dstdev = new KisPaintDevice(cs);
dev->convertFromQImage(qimage, "", 0, 0);
dev->convertFromQImage(qimage, 0, 0, 0);
// Get the predefined configuration from a file
KisFilterConfiguration * kfc = f->defaultConfiguration(dev);
......@@ -105,7 +105,7 @@ bool testFilterNoTransaction(KisFilterSP f)
QImage qimage(QString(FILES_DATA_DIR) + QDir::separator() + "lena.png");
QImage result(QString(FILES_DATA_DIR) + QDir::separator() + "lena_" + f->id() + ".png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(qimage, "", 0, 0);
dev->convertFromQImage(qimage, 0, 0, 0);
// Get the predefined configuration from a file
KisFilterConfiguration * kfc = f->defaultConfiguration(dev);
......@@ -148,7 +148,7 @@ bool testFilter(KisFilterSP f)
return false;
}
KisPaintDeviceSP dev = new KisPaintDevice(cs);