Commit b617b09a authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove obsolete enums

Substance and substrate channels won't happen anytime soon.
parent 3e9957a6
...@@ -320,6 +320,7 @@ bool KisAsyncMerger::compositeWithProjection(KisLayerSP layer, const QRect &rect ...@@ -320,6 +320,7 @@ bool KisAsyncMerger::compositeWithProjection(KisLayerSP layer, const QRect &rect
QBitArray channelFlags = layer->channelFlags(); QBitArray channelFlags = layer->channelFlags();
// if the color spaces don't match we will have a problem with the channel flags // if the color spaces don't match we will have a problem with the channel flags
// because the channel flags from the source layer doesn't match with the colorspace of the projection device // because the channel flags from the source layer doesn't match with the colorspace of the projection device
// this leads to the situation that the wrong channels will be enabled/disabled // this leads to the situation that the wrong channels will be enabled/disabled
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
* *
* The border op decides what to do with pixels too close to the edge of the rect as defined above. * The border op decides what to do with pixels too close to the edge of the rect as defined above.
* *
* The channels flag determines which set out of color channels, alpha channels, substance or substrate * The channels flag determines which set out of color channels, alpha channels.
* channels we convolve. * channels we convolve.
* *
* Note that we do not (currently) support different kernels for * Note that we do not (currently) support different kernels for
......
...@@ -189,17 +189,17 @@ void KisLayer::setSectionModelProperties(const KoDocumentSectionModel::PropertyL ...@@ -189,17 +189,17 @@ void KisLayer::setSectionModelProperties(const KoDocumentSectionModel::PropertyL
void KisLayer::disableAlphaChannel(bool disable) void KisLayer::disableAlphaChannel(bool disable)
{ {
if(m_d->channelFlags.isEmpty()) if(m_d->channelFlags.isEmpty())
m_d->channelFlags = colorSpace()->channelFlags(true, true, true, true); m_d->channelFlags = colorSpace()->channelFlags(true, true);
if(disable) if(disable)
m_d->channelFlags &= colorSpace()->channelFlags(true, false, true, true); m_d->channelFlags &= colorSpace()->channelFlags(true, false);
else else
m_d->channelFlags |= colorSpace()->channelFlags(false, true, false, false); m_d->channelFlags |= colorSpace()->channelFlags(false, true);
} }
bool KisLayer::alphaChannelDisabled() const bool KisLayer::alphaChannelDisabled() const
{ {
QBitArray flags = colorSpace()->channelFlags(false, true, false, false) & m_d->channelFlags; QBitArray flags = colorSpace()->channelFlags(false, true) & m_d->channelFlags;
return flags.count(true) == 0 && !m_d->channelFlags.isEmpty(); return flags.count(true) == 0 && !m_d->channelFlags.isEmpty();
} }
......
...@@ -214,19 +214,19 @@ QRect KisPaintLayer::exactBounds() const ...@@ -214,19 +214,19 @@ QRect KisPaintLayer::exactBounds() const
bool KisPaintLayer::alphaLocked() const bool KisPaintLayer::alphaLocked() const
{ {
QBitArray flags = colorSpace()->channelFlags(false, true, false, false) & m_d->paintChannelFlags; QBitArray flags = colorSpace()->channelFlags(false, true) & m_d->paintChannelFlags;
return flags.count(true) == 0 && !m_d->paintChannelFlags.isEmpty(); return flags.count(true) == 0 && !m_d->paintChannelFlags.isEmpty();
} }
void KisPaintLayer::setAlphaLocked(bool lock) void KisPaintLayer::setAlphaLocked(bool lock)
{ {
if(m_d->paintChannelFlags.isEmpty()) if(m_d->paintChannelFlags.isEmpty())
m_d->paintChannelFlags = colorSpace()->channelFlags(true, true, true, true); m_d->paintChannelFlags = colorSpace()->channelFlags(true, true);
if(lock) if(lock)
m_d->paintChannelFlags &= colorSpace()->channelFlags(true, false, true, true); m_d->paintChannelFlags &= colorSpace()->channelFlags(true, false);
else else
m_d->paintChannelFlags |= colorSpace()->channelFlags(false, true, false, false); m_d->paintChannelFlags |= colorSpace()->channelFlags(false, true);
} }
......
...@@ -2324,11 +2324,11 @@ void KisPainter::setMaskImageSize(qint32 width, qint32 height) ...@@ -2324,11 +2324,11 @@ void KisPainter::setMaskImageSize(qint32 width, qint32 height)
void KisPainter::setLockAlpha(bool protect) void KisPainter::setLockAlpha(bool protect)
{ {
if(d->paramInfo.channelFlags.isEmpty()) { if(d->paramInfo.channelFlags.isEmpty()) {
d->paramInfo.channelFlags = d->colorSpace->channelFlags(true, true, true, true); d->paramInfo.channelFlags = d->colorSpace->channelFlags(true, true);
} }
QBitArray switcher = QBitArray switcher =
d->colorSpace->channelFlags(protect, !protect, protect, protect); d->colorSpace->channelFlags(protect, !protect);
if(protect) { if(protect) {
d->paramInfo.channelFlags &= switcher; d->paramInfo.channelFlags &= switcher;
...@@ -2342,7 +2342,7 @@ void KisPainter::setLockAlpha(bool protect) ...@@ -2342,7 +2342,7 @@ void KisPainter::setLockAlpha(bool protect)
bool KisPainter::alphaLocked() const bool KisPainter::alphaLocked() const
{ {
QBitArray switcher = d->colorSpace->channelFlags(false, true, false, false); QBitArray switcher = d->colorSpace->channelFlags(false, true);
return !(d->paramInfo.channelFlags & switcher).count(true); return !(d->paramInfo.channelFlags & switcher).count(true);
} }
......
...@@ -95,14 +95,15 @@ bool ChannelModel::setData(const QModelIndex& index, const QVariant& value, int ...@@ -95,14 +95,15 @@ bool ChannelModel::setData(const QModelIndex& index, const QVariant& value, int
if (index.column() == 0) { if (index.column() == 0) {
QBitArray flags = m_currentLayer->channelFlags(); QBitArray flags = m_currentLayer->channelFlags();
flags = flags.isEmpty() ? m_currentLayer->colorSpace()->channelFlags(true, true, true, true) : flags;
flags = flags.isEmpty() ? m_currentLayer->colorSpace()->channelFlags(true, true) : flags;
flags.setBit(channelIndex, value.toInt() == Qt::Checked); flags.setBit(channelIndex, value.toInt() == Qt::Checked);
m_currentLayer->setChannelFlags(flags); m_currentLayer->setChannelFlags(flags);
} }
else { //if (index.column() == 1) else { //if (index.column() == 1)
KisPaintLayer* paintLayer = dynamic_cast<KisPaintLayer*>(m_currentLayer.data()); KisPaintLayer* paintLayer = dynamic_cast<KisPaintLayer*>(m_currentLayer.data());
QBitArray flags = paintLayer->channelLockFlags(); QBitArray flags = paintLayer->channelLockFlags();
flags = flags.isEmpty() ? m_currentLayer->colorSpace()->channelFlags(true, true, true, true) : flags; flags = flags.isEmpty() ? m_currentLayer->colorSpace()->channelFlags(true, true) : flags;
flags.setBit(channelIndex, value.toInt() == Qt::Unchecked); flags.setBit(channelIndex, value.toInt() == Qt::Unchecked);
paintLayer->setChannelLockFlags(flags); paintLayer->setChannelLockFlags(flags);
} }
......
...@@ -481,12 +481,12 @@ public: ...@@ -481,12 +481,12 @@ public:
KisPaintDeviceSP interm = new KisPaintDevice(pixelSelection->colorSpace()); KisPaintDeviceSP interm = new KisPaintDevice(pixelSelection->colorSpace());
KisConvolutionPainter horizPainter(interm); KisConvolutionPainter horizPainter(interm);
horizPainter.setChannelFlags(interm->colorSpace()->channelFlags(false, true, false, false)); horizPainter.setChannelFlags(interm->colorSpace()->channelFlags(false, true));
horizPainter.applyMatrix(kernelHoriz, pixelSelection, rect.topLeft(), rect.topLeft(), rect.size(), BORDER_AVOID); horizPainter.applyMatrix(kernelHoriz, pixelSelection, rect.topLeft(), rect.topLeft(), rect.size(), BORDER_AVOID);
horizPainter.end(); horizPainter.end();
KisConvolutionPainter verticalPainter(pixelSelection); KisConvolutionPainter verticalPainter(pixelSelection);
verticalPainter.setChannelFlags(pixelSelection->colorSpace()->channelFlags(false, true, false, false)); verticalPainter.setChannelFlags(pixelSelection->colorSpace()->channelFlags(false, true));
verticalPainter.applyMatrix(kernelVertical, interm, rect.topLeft(), rect.topLeft(), rect.size(), BORDER_AVOID); verticalPainter.applyMatrix(kernelVertical, interm, rect.topLeft(), rect.topLeft(), rect.size(), BORDER_AVOID);
verticalPainter.end(); verticalPainter.end();
} }
......
...@@ -104,17 +104,15 @@ QList<KoChannelInfo *> KoColorSpace::channels() const ...@@ -104,17 +104,15 @@ QList<KoChannelInfo *> KoColorSpace::channels() const
return d->channels; return d->channels;
} }
QBitArray KoColorSpace::channelFlags(bool color, bool alpha, bool substance, bool substrate) const QBitArray KoColorSpace::channelFlags(bool color, bool alpha) const
{ {
QBitArray ba(d->channels.size()); QBitArray ba(d->channels.size());
if (!color && !alpha && !substance && !substrate) return ba; if (!color && !alpha) return ba;
for (int i = 0; i < d->channels.size(); ++i) { for (int i = 0; i < d->channels.size(); ++i) {
KoChannelInfo * channel = d->channels.at(i); KoChannelInfo * channel = d->channels.at(i);
if ((color && channel->channelType() == KoChannelInfo::COLOR) || if ((color && channel->channelType() == KoChannelInfo::COLOR) ||
(alpha && channel->channelType() == KoChannelInfo::ALPHA) || (alpha && channel->channelType() == KoChannelInfo::ALPHA))
(substrate && channel->channelType() == KoChannelInfo::SUBSTRATE) ||
(substance && channel->channelType() == KoChannelInfo::SUBSTANCE))
ba.setBit(i, true); ba.setBit(i, true);
} }
return ba; return ba;
......
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
virtual quint32 channelCount() const = 0; virtual quint32 channelCount() const = 0;
/** /**
* The total number of color channels (excludes alpha and substance) for a single * The total number of color channels (excludes alpha) for a single
* pixel in this color model. * pixel in this color model.
*/ */
virtual quint32 colorChannelCount() const = 0; virtual quint32 colorChannelCount() const = 0;
...@@ -129,13 +129,11 @@ public: ...@@ -129,13 +129,11 @@ public:
* *
* @param color if true, set all color channels to true * @param color if true, set all color channels to true
* @param alpha if true, set all alpha channels to true * @param alpha if true, set all alpha channels to true
* @param substance if true, set all substance channels to true
* @param substrate if true, set all substrate channels to true
* *
* The order of channels is the colorspace descriptive order, * The order of channels is the colorspace descriptive order,
* not the pixel order. * not the pixel order.
*/ */
QBitArray channelFlags(bool color = true, bool alpha = false, bool substance = false, bool substrate = false) const; QBitArray channelFlags(bool color = true, bool alpha = false) const;
/** /**
* The size in bytes of a single pixel in this color model * The size in bytes of a single pixel in this color model
......
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