Commit e4b42d28 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Fix non-painting space deformation

By disabling it... this looks a bit odd, might be changed.

Ref T2337
parent 0246b4ba
......@@ -78,3 +78,8 @@ qreal KoDumbColorDisplayRenderer::maxVisibleFloatValue(const KoChannelInfo *chan
Q_ASSERT(chaninfo);
return chaninfo->getUIMax();
}
const KoColorSpace* KoDumbColorDisplayRenderer::getPaintingColorSpace() const
{
return KoColorSpaceRegistry::instance()->rgb8();
}
......@@ -80,6 +80,12 @@ public:
*/
virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const = 0;
/**
* @brief getColorSpace
* @return the painting color space, this is useful for determining the transform.
*/
virtual const KoColorSpace* getPaintingColorSpace() const = 0;
Q_SIGNALS:
void displayConfigurationChanged();
......@@ -103,6 +109,8 @@ public:
virtual qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const;
virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const;
virtual const KoColorSpace* getPaintingColorSpace() const;
static KoColorDisplayRendererInterface* instance();
};
......
......@@ -141,6 +141,10 @@ struct KisDisplayColorConverter::Private
return maxValue;
}
virtual const KoColorSpace* getPaintingColorSpace() const {
return m_parent->paintingColorSpace();
}
private:
KisDisplayColorConverter *m_parent;
QPointer<KoCanvasResourceManager> m_resourceManager;
......
......@@ -262,22 +262,23 @@ void KisVisualColorSelectorShape::setDisplayRenderer (const KoColorDisplayRender
m_d->displayRenderer->disconnect(this);
}
m_d->displayRenderer = displayRenderer;
connect(m_d->displayRenderer, SIGNAL(displayConfigurationChanged()),
SLOT(updateFromChangedDisplayRenderer()), Qt::UniqueConnection);
} else {
m_d->displayRenderer = KoDumbColorDisplayRenderer::instance();
}
connect(m_d->displayRenderer, SIGNAL(displayConfigurationChanged()),
SLOT(updateFromChangedDisplayRenderer()), Qt::UniqueConnection);
}
void KisVisualColorSelectorShape::updateFromChangedDisplayRenderer()
{
m_d->pixmapsNeedUpdate = true;
repaint();
updateCursor();
update();
}
QColor KisVisualColorSelectorShape::getColorFromConverter(KoColor c){
QColor col;
if (m_d->displayRenderer) {
if (m_d->displayRenderer && m_d->displayRenderer->getPaintingColorSpace()==m_d->cs) {
col = m_d->displayRenderer->toQColor(c);
} else {
col = c.toQColor();
......@@ -326,7 +327,7 @@ KoColor KisVisualColorSelectorShape::convertShapeCoordinateToKoColor(QPointF coo
c.colorSpace()->normalisedChannelsValue(c.data(), channelValues);
QVector <qreal> maxvalue(c.colorSpace()->channelCount());
maxvalue.fill(1.0);
if (m_d->displayRenderer) {
if (m_d->displayRenderer && m_d->displayRenderer->getPaintingColorSpace()==m_d->cs) {
for (int ch = 0; ch<maxvalue.size(); ch++) {
KoChannelInfo *channel = m_d->cs->channels()[ch];
maxvalue[ch] = m_d->displayRenderer->maxVisibleFloatValue(channel);
......@@ -408,7 +409,7 @@ QPointF KisVisualColorSelectorShape::convertKoColorToShapeCoordinate(KoColor c)
m_d->cs->normalisedChannelsValue(c.data(), channelValues);
QVector <qreal> maxvalue(c.colorSpace()->channelCount());
maxvalue.fill(1.0);
if (m_d->displayRenderer) {
if (m_d->displayRenderer && m_d->displayRenderer->getPaintingColorSpace()==m_d->cs) {
for (int ch = 0; ch<maxvalue.size(); ch++) {
KoChannelInfo *channel = m_d->cs->channels()[ch];
maxvalue[ch] = m_d->displayRenderer->maxVisibleFloatValue(channel);
......@@ -514,8 +515,9 @@ void KisVisualColorSelectorShape::paintEvent(QPaintEvent*)
{
QPainter painter(this);
//check if old and new colors differ.
if (m_d->pixmapsNeedUpdate) {
getPixmap();
setMask(getMaskMap());
}
drawCursor();
......
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