Commit e390a99c authored by Cyrille Berger's avatar Cyrille Berger

alpha/alpha2 -> opacityU8/opacityF

svn path=/trunk/koffice/; revision=1092247
parent fb551cac
......@@ -58,7 +58,7 @@ void KisStrokeBenchmark::benchmarkStroke()
int height = TEST_IMAGE_HEIGHT;
KisImageSP image = new KisImage(0, width, height, m_colorSpace, "stroke sample image", false);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE, m_colorSpace);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE_U8, m_colorSpace);
KoColor white(m_colorSpace);
white.fromQColor(Qt::white);
......@@ -99,7 +99,7 @@ void KisStrokeBenchmark::benchmarkRandomLines()
int height = TEST_IMAGE_HEIGHT;
KisImageSP image = new KisImage(0, width, height, m_colorSpace, "stroke sample image", false);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE, m_colorSpace);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE_U8, m_colorSpace);
KoColor white(m_colorSpace);
white.fromQColor(Qt::white);
......
......@@ -98,7 +98,7 @@ QImage KisPaintOpSettings::sampleStroke(const QSize& size)
int width = size.width();
int height = size.height();
KisLayerSP layer = new KisPaintLayer(0, "temporary for stroke sample", OPACITY_OPAQUE, cs);
KisLayerSP layer = new KisPaintLayer(0, "temporary for stroke sample", OPACITY_OPAQUE_U8, cs);
KisImageSP image = new KisImage(0, width, height, cs, "stroke sample image", false);
KisPainter painter(layer->paintDevice());
painter.setPaintColor(KoColor(Qt::black, cs));
......
......@@ -81,7 +81,7 @@ KisPaintDeviceSP KisBaseNode::projection() const
quint8 KisBaseNode::opacity() const
{
return nodeProperties().intProperty("opacity", OPACITY_OPAQUE);
return nodeProperties().intProperty("opacity", OPACITY_OPAQUE_U8);
}
void KisBaseNode::setOpacity(quint8 val)
......
......@@ -99,7 +99,7 @@ void KisFillPainter::fillRect(qint32 x1, qint32 y1, qint32 w, qint32 h, const Ko
KoColor kc2(kc); // get rid of const
kc2.convertTo(device()->colorSpace());
quint8 * data = kc2.data();
device()->colorSpace()->setAlpha(data, opacity, 1);
device()->colorSpace()->setOpacity(data, opacity, 1);
device()->fill(x1, y1, w, h, data);
......@@ -334,7 +334,7 @@ KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY, KisP
selIt += x;
if (m_fuzzy) {
colorSpace->fromQColor(Qt::white, selIt.rawData());
colorSpace->setAlpha(selIt.rawData(), MAX_SELECTED - diff, 1);
colorSpace->setOpacity(selIt.rawData(), quint8(MAX_SELECTED - diff), 1);
} else
colorSpace->fromQColor(Qt::white, selIt.rawData());
......@@ -376,7 +376,7 @@ KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY, KisP
if (m_fuzzy) {
colorSpace->fromQColor(Qt::white, selIt.rawData());
colorSpace->setAlpha(selIt.rawData(), MAX_SELECTED - diff, 1);
colorSpace->setOpacity(selIt.rawData(), quint8(MAX_SELECTED - diff), 1);
} else
colorSpace->fromQColor(Qt::white, selIt.rawData());
......@@ -435,7 +435,7 @@ KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY, KisP
if (m_fuzzy) {
colorSpace->fromQColor(Qt::white, selIt.rawData());
colorSpace->setAlpha(selIt.rawData(), MAX_SELECTED - diff, 1);
colorSpace->setOpacity(selIt.rawData(), quint8(MAX_SELECTED - diff), 1);
} else
colorSpace->fromQColor(Qt::white, selIt.rawData());
......
......@@ -225,13 +225,13 @@ private:
inline
void KisFillPainter::fillRect(qint32 x, qint32 y, qint32 w, qint32 h, const KoColor& c)
{
fillRect(x, y, w, h, c, OPACITY_OPAQUE);
fillRect(x, y, w, h, c, OPACITY_OPAQUE_U8);
}
inline
void KisFillPainter::fillRect(const QRect& rc, const KoColor& c)
{
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_OPAQUE);
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_OPAQUE_U8);
}
inline
......@@ -239,7 +239,7 @@ void KisFillPainter::eraseRect(qint32 x1, qint32 y1, qint32 w, qint32 h)
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor c(Qt::black, cs);
fillRect(x1, y1, w, h, c, OPACITY_TRANSPARENT);
fillRect(x1, y1, w, h, c, OPACITY_TRANSPARENT_U8);
}
inline
......@@ -247,7 +247,7 @@ void KisFillPainter::eraseRect(const QRect& rc)
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor c(Qt::black, cs);
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_TRANSPARENT);
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_TRANSPARENT_U8);
}
inline
......
......@@ -160,7 +160,7 @@ void KisFixedPaintDevice::clear(const QRect & rc)
KoColor c(Qt::black, m_colorSpace);
quint8* black = m_colorSpace->allocPixelBuffer(1);
memcpy(black, c.data(), m_colorSpace->pixelSize());
m_colorSpace->setAlpha(black, OPACITY_TRANSPARENT, 1);
m_colorSpace->setOpacity(black, OPACITY_TRANSPARENT_U8, 1);
fill(rc.x(), rc.y(), rc.width(), rc.height(), black);
delete[] black;
}
......
......@@ -187,18 +187,18 @@ public:
return false;
}
virtual quint8 alpha(const quint8 * /*pixel*/) const {
virtual quint8 opacityU8(const quint8 * /*pixel*/) const {
return 0;
}
virtual qreal alpha2(const quint8 * /*pixel*/) const {
virtual qreal opacityF(const quint8 * /*pixel*/) const {
return 0;
}
virtual void setAlpha(quint8 * /*pixels*/, quint8 /*alpha*/, qint32 /*nPixels*/) const { }
virtual void setOpacity(quint8 * /*pixels*/, quint8 /*alpha*/, qint32 /*nPixels*/) const { }
virtual void setAlpha2(quint8 * /*pixels*/, qreal /*alpha*/, qint32 /*nPixels*/) const { }
virtual void setOpacity(quint8 * /*pixels*/, qreal /*alpha*/, qint32 /*nPixels*/) const { }
virtual void multiplyAlpha(quint8 * /*pixels*/, quint8 /*alpha*/, qint32 /*nPixels*/) const { }
......
......@@ -628,7 +628,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
double maxDistance = 0;
quint8* thisPixel = colorSpace->allocPixelBuffer(1);
memcpy(thisPixel, iter.rawData(), pixelSize);
quint8 thisPixelOpacity = colorSpace->alpha(thisPixel);
quint8 thisPixelOpacity = colorSpace->opacityU8(thisPixel);
// XXX: Move the distance computation into the colorspace when it works.
for (int yOffset = -1; yOffset < 2; yOffset++) {
......@@ -644,7 +644,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
accessor.moveTo(x, y);
quint8 * pixel = accessor.rawData();
quint8 opacity = colorSpace->alpha(pixel);
quint8 opacity = colorSpace->opacityU8(pixel);
double totalDistance = 0;
......@@ -738,7 +738,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
}
}
}
totalOpacity += colorSpace->alpha(color.data());
totalOpacity += colorSpace->opacityU8(color.data());
}
}
accessor.moveTo(x - startx, y - starty);
......@@ -750,7 +750,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
memcpy(pixel + pos, &val, channel->size());
}
}
colorSpace->setAlpha(pixel, totalOpacity, 1);
colorSpace->setOpacity(pixel, quint8(totalOpacity), 1);
}
pixelsProcessed++;
......
......@@ -110,7 +110,7 @@ KisPaintDeviceSP KisGroupLayer::tryObligeChild() const
child->channelFlags().isEmpty() &&
child->projection() &&
child->visible() &&
child->opacity() == OPACITY_OPAQUE &&
child->opacity() == OPACITY_OPAQUE_U8 &&
*child->projection()->colorSpace() == *colorSpace()) {
return child->projection();
......
......@@ -307,7 +307,7 @@ void KisImage::init(KisUndoAdapter *adapter, qint32 width, qint32 height, const
m_d->colorSpace = colorSpace;
setRootLayer(new KisGroupLayer(this, "root", OPACITY_OPAQUE));
setRootLayer(new KisGroupLayer(this, "root", OPACITY_OPAQUE_U8));
m_d->xres = 1.0;
m_d->yres = 1.0;
......@@ -744,7 +744,7 @@ void KisImage::flatten()
{
KisGroupLayerSP oldRootLayer = m_d->rootLayer;
KisGroupLayerSP newRootLayer =
new KisGroupLayer(this, "root", OPACITY_OPAQUE);
new KisGroupLayer(this, "root", OPACITY_OPAQUE_U8);
// - synchronous?
// - no =(
......@@ -758,7 +758,7 @@ void KisImage::flatten()
unlock();
KisPaintLayerSP flattenLayer =
new KisPaintLayer(this, nextLayerName(), OPACITY_OPAQUE, projectionCopy);
new KisPaintLayer(this, nextLayerName(), OPACITY_OPAQUE_U8, projectionCopy);
Q_CHECK_PTR(flattenLayer);
m_d->adapter->beginMacro(i18n("Flatten Image"));
......@@ -797,7 +797,7 @@ KisLayerSP KisImage::mergeLayer(KisLayerSP layer, const KisMetaData::MergeStrate
// FIXME: "Merge Down"?
undoAdapter()->beginMacro(i18n("Merge with Layer Below"));
KisPaintLayerSP mergedLayer = new KisPaintLayer(this, prevLayer->name(), OPACITY_OPAQUE, mergedDevice);
KisPaintLayerSP mergedLayer = new KisPaintLayer(this, prevLayer->name(), OPACITY_OPAQUE_U8, mergedDevice);
Q_CHECK_PTR(mergedLayer);
......
......@@ -141,7 +141,7 @@ KisPaintDevice::KisPaintDevice(KisNodeWSP parent, const KoColorSpace * colorSpac
quint8 *defaultPixel = new quint8[ m_d->pixelSize ];
m_d->colorSpace->fromQColor(Qt::black, defaultPixel);
m_d->colorSpace->setAlpha(defaultPixel, OPACITY_TRANSPARENT, 1);
m_d->colorSpace->setOpacity(defaultPixel, OPACITY_TRANSPARENT_U8, 1);
m_datamanager = new KisDataManager(m_d->pixelSize, defaultPixel);
delete [] defaultPixel;
......
This diff is collapsed.
......@@ -47,7 +47,7 @@ public:
KisSelectionBasedLayer::KisSelectionBasedLayer(KisImageWSP image,
const QString &name,
KisSelectionSP selection)
: KisLayer(image.data(), name, OPACITY_OPAQUE),
: KisLayer(image.data(), name, OPACITY_OPAQUE_U8),
m_d(new Private())
{
if (!selection)
......
......@@ -359,7 +359,7 @@ void KisTransformWorker::transformPass(KisPaintDevice *src, KisPaintDevice *dst,
while (i < srcLen + extraLen) {
data = srcIt.rawData();
memcpy(&tmpLine[i*pixelSize], data, pixelSize);
cs->setAlpha(data, 0, 1);
cs->setOpacity(data, quint8(0), 1);
if (i < srcLen + extraLen - 1) // duplicate pixels along edge
++srcIt;
i++;
......
......@@ -287,7 +287,7 @@ void KisRecordedPaintAction::play(KisNodeSP node, const KisPlayInfo& info) const
painter->setOpacity(d->opacity * 255);
} else {
painter->setCompositeOp(node->paintDevice()->colorSpace()->compositeOp(COMPOSITE_ALPHA_DARKEN));
painter->setOpacity(OPACITY_OPAQUE);
painter->setOpacity(OPACITY_OPAQUE_U8);
}
......@@ -451,7 +451,7 @@ KoColor KisRecordedPaintActionFactory::colorFromXML(const QDomElement& elt, cons
if (!colorElt.isNull()) {
bC = KoColor::fromXML(colorElt.firstChildElement(), Integer8BitsColorDepthID.id(), QHash<QString, QString>());
bC.setOpacity(255);
bC.setOpacity(quint8(255));
dbgImage << elementName << " color : " << bC.toQColor();
} else {
dbgImage << "Warning: no <" << elementName << " /> found";
......
......@@ -64,8 +64,8 @@ void KisAsyncMergerTest::testMerger()
KisFilterConfiguration *configuration = filter->defaultConfiguration(0);
Q_ASSERT(configuration);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE, device1);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE, device2);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, device1);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8, device2);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", 200/*OPACITY_OPAQUE*/);
KisLayerSP blur1 = new KisAdjustmentLayer(image, "blur1", configuration, 0);
......@@ -142,8 +142,8 @@ void KisAsyncMergerTest::debugObligeChild()
KisPaintDeviceSP device1 = new KisPaintDevice(colorSpace);
device1->convertFromQImage(sourceImage1, "", 0, 0);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE, device1);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, device1);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
image->addNode(groupLayer, image->rootLayer());
image->addNode(paintLayer1, groupLayer);
......
......@@ -32,10 +32,9 @@ void KisCloneLayerTest::testCreation()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageWSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
KisLayerSP layer = new KisPaintLayer(image, "clone test", OPACITY_OPAQUE);
KisLayerSP layer = new KisPaintLayer(image, "clone test", OPACITY_OPAQUE_U8);
KisCloneLayer test(layer, image, "clonetest", OPACITY_OPAQUE
);
KisCloneLayer test(layer, image, "clonetest", OPACITY_OPAQUE_U8);
}
......
......@@ -37,7 +37,7 @@ void KisColorSpaceConvertVisitorTest::testCreation()
QVERIFY(lab);
TestUtil::KisUndoAdapterDummy* undoAdapterDummy = new TestUtil::KisUndoAdapterDummy();
KisImageSP image = new KisImage(undoAdapterDummy, 100, 100, lab, "test");
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE, lab);
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE_U8, lab);
KisColorSpaceConvertVisitor test(image, rgb, KoColorConversionTransformation::IntentPerceptual);
layer->accept(test);
QVERIFY(layer->colorSpace()->colorModelId() == rgb->colorModelId());
......
......@@ -40,7 +40,7 @@ void KisCropVisitorTest::testUndo()
TestUtil::KisUndoAdapterDummy* undoAdapterDummy = new TestUtil::KisUndoAdapterDummy();
KisImageSP image = new KisImage(undoAdapterDummy, 300, 300, cs, "test");
image->lock();
KisPaintLayerSP layer = new KisPaintLayer(image, "testlayer", OPACITY_OPAQUE);
KisPaintLayerSP layer = new KisPaintLayer(image, "testlayer", OPACITY_OPAQUE_U8);
KisPaintDeviceSP dev = layer->paintDevice();
KisFillPainter painter(dev);
......
......@@ -176,7 +176,7 @@ void KisFixedPaintDeviceTest::testClear()
KisFixedPaintDeviceSP dev = new KisFixedPaintDevice(cs);
dev->clear(QRect(0, 0, 100, 100));
QVERIFY(dev->bounds() == QRect(0, 0, 100, 100));
QVERIFY(cs->alpha(dev->data() + (50 * 50 * cs->pixelSize())) == OPACITY_TRANSPARENT);
QVERIFY(cs->opacityU8(dev->data() + (50 * 50 * cs->pixelSize())) == OPACITY_TRANSPARENT_U8);
}
void KisFixedPaintDeviceTest::testFill()
......@@ -184,13 +184,13 @@ void KisFixedPaintDeviceTest::testFill()
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
quint8* red = new quint8[cs->pixelSize()];
memcpy(red, KoColor(Qt::red, cs).data(), cs->pixelSize());;
cs->setAlpha(red, 128, 1);
cs->setOpacity(red, quint8(128), 1);
KisFixedPaintDeviceSP dev = new KisFixedPaintDevice(cs);
dev->fill(0, 0, 100, 100, red);
QVERIFY(dev->bounds() == QRect(0, 0, 100, 100));
QVERIFY(cs->alpha(dev->data()) == 128);
QVERIFY(cs->opacityU8(dev->data()) == 128);
QVERIFY(memcmp(dev->data(), red, cs->pixelSize()) == 0);
delete[] red;
......
......@@ -39,7 +39,7 @@ void KisImageTest::layerTests()
QVERIFY(image->rootLayer() != 0);
QVERIFY(image->rootLayer()->firstChild() == 0);
KisLayerSP layer = new KisPaintLayer(image, "layer 1", OPACITY_OPAQUE);
KisLayerSP layer = new KisPaintLayer(image, "layer 1", OPACITY_OPAQUE_U8);
image->addNode(layer);
QVERIFY(image->rootLayer()->firstChild()->objectName() == layer->objectName());
......
......@@ -42,9 +42,9 @@ void KisLayerTest::testCreation()
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
image->lock();
KisLayerSP layer = new TestLayer(image, "test", OPACITY_OPAQUE);
KisLayerSP layer = new TestLayer(image, "test", OPACITY_OPAQUE_U8);
QCOMPARE(layer->name(), QString("test"));
QCOMPARE(layer->opacity(), OPACITY_OPAQUE);
QCOMPARE(layer->opacity(), OPACITY_OPAQUE_U8);
QCOMPARE(layer->image().data(), image.data());
QCOMPARE(layer->colorSpace(), image->colorSpace());
QCOMPARE(layer->visible(), true);
......@@ -63,12 +63,12 @@ void KisLayerTest::testCreation()
QCOMPARE(layer->channelFlags().at(3), true);
layer->setOpacity(OPACITY_TRANSPARENT);
QCOMPARE(layer->opacity(), OPACITY_TRANSPARENT);
layer->setOpacity(OPACITY_TRANSPARENT_U8);
QCOMPARE(layer->opacity(), OPACITY_TRANSPARENT_U8);
layer->setPercentOpacity(100);
QCOMPARE(layer->opacity(), OPACITY_OPAQUE);
QCOMPARE(layer->opacity(), OPACITY_OPAQUE_U8);
layer->setPercentOpacity(0);
QCOMPARE(layer->opacity(), OPACITY_TRANSPARENT);
QCOMPARE(layer->opacity(), OPACITY_TRANSPARENT_U8);
}
......@@ -79,9 +79,9 @@ void KisLayerTest::testOrdering()
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
image->lock();
KisLayerSP layer1 = new TestLayer(image, "layer1", OPACITY_OPAQUE);
KisLayerSP layer2 = new TestLayer(image, "layer2", OPACITY_OPAQUE);
KisLayerSP layer3 = new TestLayer(image, "layer3", OPACITY_OPAQUE);
KisLayerSP layer1 = new TestLayer(image, "layer1", OPACITY_OPAQUE_U8);
KisLayerSP layer2 = new TestLayer(image, "layer2", OPACITY_OPAQUE_U8);
KisLayerSP layer3 = new TestLayer(image, "layer3", OPACITY_OPAQUE_U8);
QVERIFY(layer1->name() == "layer1");
QVERIFY(layer2->name() == "layer2");
......@@ -164,9 +164,9 @@ void KisLayerTest::testMoveNode()
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
image->lock();
KisLayerSP node1 = new TestLayer(image, "layer1", OPACITY_OPAQUE);
KisLayerSP node2 = new TestLayer(image, "layer2", OPACITY_OPAQUE);
KisLayerSP node3 = new TestLayer(image, "layer3", OPACITY_OPAQUE);
KisLayerSP node1 = new TestLayer(image, "layer1", OPACITY_OPAQUE_U8);
KisLayerSP node2 = new TestLayer(image, "layer2", OPACITY_OPAQUE_U8);
KisLayerSP node3 = new TestLayer(image, "layer3", OPACITY_OPAQUE_U8);
node1->setName("node1");
node2->setName("node2");
......@@ -195,9 +195,9 @@ void KisLayerTest::testMoveLayer()
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
image->lock();
KisLayerSP node1 = new TestLayer(image, "layer1", OPACITY_OPAQUE);
KisLayerSP node2 = new TestLayer(image, "layer2", OPACITY_OPAQUE);
KisLayerSP node3 = new TestLayer(image, "layer3", OPACITY_OPAQUE);
KisLayerSP node1 = new TestLayer(image, "layer1", OPACITY_OPAQUE_U8);
KisLayerSP node2 = new TestLayer(image, "layer2", OPACITY_OPAQUE_U8);
KisLayerSP node3 = new TestLayer(image, "layer3", OPACITY_OPAQUE_U8);
node1->setName("node1");
node2->setName("node2");
node3->setName("node3");
......@@ -220,7 +220,7 @@ void KisLayerTest::testMoveLayer()
void KisLayerTest::testHasEffectMasks()
{
KisLayerSP layer = new TestLayer(0, "layer1", OPACITY_OPAQUE) ;
KisLayerSP layer = new TestLayer(0, "layer1", OPACITY_OPAQUE_U8);
QVERIFY(layer->hasEffectMasks() == false);
KisFilterMaskSP mask = new KisFilterMask();
layer->setPreviewMask(mask);
......
......@@ -136,16 +136,16 @@ void KisPaintDeviceTest::testGeometry()
dev->clear(QRect(50, 50, 50, 50));
dev->pixel(80, 80, &c);
QVERIFY(c.alpha() == OPACITY_TRANSPARENT);
QVERIFY(c.alpha() == OPACITY_TRANSPARENT_U8);
dev->fill(0, 0, 512, 512, pixel);
dev->pixel(80, 80, &c);
QVERIFY(c == Qt::white);
QVERIFY(c.alpha() == OPACITY_OPAQUE);
QVERIFY(c.alpha() == OPACITY_OPAQUE_U8);
dev->clear();
dev->pixel(80, 80, &c);
QVERIFY(c.alpha() == OPACITY_TRANSPARENT);
QVERIFY(c.alpha() == OPACITY_TRANSPARENT_U8);
// XXX: No idea why we get this extent and bounds after a clear --
// but I want to know as soon as possible if this behaviour
......
......@@ -43,7 +43,7 @@ void KisPaintLayerTest::testProjection()
KisImageSP image = new KisImage(0, qimage.width(), qimage.height(), cs, "merge test");
image->lock(); // We'll call for recomposition ourselves
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE);
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE_U8);
layer->paintDevice()->convertFromQImage(qimage, 0, 0, 0);
image->addNode(layer.data());
......@@ -82,7 +82,7 @@ void KisPaintLayerTest::testProjection()
// By default a new transparency mask blanks out the entire layer (photoshop mode "hide all")
KisRectConstIterator it = layer->projection()->createRectConstIterator(0, 0, qimage.width(), qimage.height());
while (!it.isDone()) {
QVERIFY(cs->alpha(it.rawData()) == OPACITY_OPAQUE);
QVERIFY(cs->opacityU8(it.rawData()) == OPACITY_OPAQUE_U8);
++it;
}
......
......@@ -84,7 +84,7 @@ void KisPainterTest::testPaintDeviceBltSelection(const KoColorSpace * cs)
KisPaintDeviceSP src = new KisPaintDevice(cs);
KoColor c(Qt::red, cs);
c.setOpacity(128);
c.setOpacity(quint8(128));
src->fill(0, 0, 20, 20, c.data());
QCOMPARE(src->exactBounds(), QRect(0, 0, 20, 20));
......@@ -160,7 +160,7 @@ void KisPainterTest::testPaintDeviceBltSelectionIrregular(const KoColorSpace * c
dst->pixel(13, 13, &c);
QCOMPARE((int) c.alpha(), (int) OPACITY_TRANSPARENT);
QCOMPARE((int) c.alpha(), (int) OPACITY_TRANSPARENT_U8);
}
}
}
......
......@@ -37,7 +37,7 @@ void KisPixelSelectionTest::testCreation()
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, cs, "merge test");
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE);
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE_U8);
KisPaintDeviceSP dev = layer->paintDevice();
KisPixelSelectionSP selection = new KisPixelSelection();
......
......@@ -33,8 +33,8 @@ void KisProjectionTest::testDirty()
KisImageSP image = new KisImage(0, 1000, 1000, 0, "layer tests");
// Two layers so the single-layer-is-rootlayer optimization doesn't kick in
KisLayerSP layer = new KisPaintLayer(image, "layer 1", OPACITY_OPAQUE);
KisLayerSP layer2 = new KisPaintLayer(image, "layer 2", OPACITY_OPAQUE);
KisLayerSP layer = new KisPaintLayer(image, "layer 1", OPACITY_OPAQUE_U8);
KisLayerSP layer2 = new KisPaintLayer(image, "layer 2", OPACITY_OPAQUE_U8);
image->addNode(layer);
image->addNode(layer2);
KisFillPainter gc(layer2->paintDevice());
......
......@@ -36,7 +36,7 @@ void KisRecordedFilterActionTest::testCreation()
KisFilterSP f = KisFilterRegistry::instance()->value("invert");
KisFilterConfiguration * kfc = f->defaultConfiguration(0);
KisImageSP image = new KisImage(0, 10, 10, cs, "merge test");
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE);
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE_U8);
KisRecordedFilterAction test("invert", KisNodeQueryPath::absolutePath(layer), f, kfc);
}
......
......@@ -145,13 +145,13 @@ void KisWalkersTest::testUsualVisiting()
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "walker test");
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE_U8);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
KisLayerSP adjustmentLayer = new KisAdjustmentLayer(image, "adj", 0, 0);
......@@ -218,15 +218,15 @@ void KisWalkersTest::testMergeVisiting()
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "walker test");
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE_U8);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE);
KisLayerSP complexRectsLayer1 = new ComplexRectsLayer(image, "cplx1", OPACITY_OPAQUE);
KisLayerSP complexRectsLayer2 = new ComplexRectsLayer(image, "cplx2", OPACITY_OPAQUE);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
KisLayerSP complexRectsLayer1 = new ComplexRectsLayer(image, "cplx1", OPACITY_OPAQUE_U8);
KisLayerSP complexRectsLayer2 = new ComplexRectsLayer(image, "cplx2", OPACITY_OPAQUE_U8);
image->addNode(paintLayer1, image->rootLayer());
image->addNode(groupLayer, image->rootLayer());
......@@ -313,15 +313,15 @@ void KisWalkersTest::testFullRefreshVisiting()
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "walker test");
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE_U8);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE);
KisLayerSP complexRectsLayer1 = new ComplexRectsLayer(image, "cplx1", OPACITY_OPAQUE);
KisLayerSP complexRectsLayer2 = new ComplexRectsLayer(image, "cplx2", OPACITY_OPAQUE);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
KisLayerSP complexRectsLayer1 = new ComplexRectsLayer(image, "cplx1", OPACITY_OPAQUE_U8);
KisLayerSP complexRectsLayer2 = new ComplexRectsLayer(image, "cplx2", OPACITY_OPAQUE_U8);
image->addNode(paintLayer1, image->rootLayer());
image->addNode(groupLayer, image->rootLayer());
......@@ -369,14 +369,14 @@ void KisWalkersTest::testCachedVisiting()
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "walker test");
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE_U8);
KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE_U8);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE);
KisLayerSP cacheLayer1 = new CacheLayer(image, "cache1", OPACITY_OPAQUE);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
KisLayerSP cacheLayer1 = new CacheLayer(image, "cache1", OPACITY_OPAQUE_U8);
image->addNode(paintLayer1, image->rootLayer());
image->addNode(groupLayer, image->rootLayer());
......
......@@ -94,7 +94,7 @@ public:
virtual void applyInverseU8Mask(quint8 * pixels, const quint8 * alpha, qint32 nPixels) const {
for (; nPixels > 0; --nPixels, pixels += m_pixelSize, ++alpha) {
_ChannelType_ valpha = KoColorSpaceMaths<quint8, _ChannelType_>::scaleToA(OPACITY_OPAQUE - *alpha);
_ChannelType_ valpha = KoColorSpaceMaths<quint8, _ChannelType_>::scaleToA(OPACITY_OPAQUE_U8 - *alpha);
_ChannelType_* alphapixel = channel(pixels);
*alphapixel = KoColorSpaceMaths<_ChannelType_>::multiply(*alphapixel, valpha);
}
......
......@@ -248,7 +248,7 @@ void KoCtlColorSpace::fromQColor(const QColor& color, quint8 *dst, const KoColor
d->qcolordata[1] = KoColorSpaceMaths<quint8, quint16>::scaleToA(color.green());
d->qcolordata[0] = KoColorSpaceMaths<quint8, quint16>::scaleToA(color.blue());