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

Fix color conversion issues with the selector.

Now the selector will show grayscale on a mask, and will update upon changing the image color space.

Ref T2438
parent 3dc39758
......@@ -63,6 +63,7 @@
#include "kis_favorite_resource_manager.h"
#include "kis_display_color_converter.h"
#include <kis_canvas2.h>
#include <kis_image.h>
KisControlFrame::KisControlFrame(KisViewManager *view, QWidget *parent, const char* name)
......@@ -140,6 +141,8 @@ void KisControlFrame::slotUpdateDisplayRenderer()
if (m_viewManager->canvasBase()){
m_dual->setDisplayRenderer(m_viewManager->canvasBase()->displayColorConverter()->displayRendererInterface());
m_dual->setColorSpace(m_viewManager->canvasBase()->image()->colorSpace());
m_viewManager->canvasBase()->image()->disconnect(m_dual);
connect(m_viewManager->canvasBase()->image(), SIGNAL(sigColorSpaceChanged(const KoColorSpace*)), m_dual, SLOT(setColorSpace(const KoColorSpace*)), Qt::UniqueConnection);
} else if (m_viewManager->viewCount()==0) {
m_dual->setDisplayRenderer();
}
......
......@@ -525,7 +525,9 @@ void KisVisualColorSelectorShape::forceImageUpdate()
QColor KisVisualColorSelectorShape::getColorFromConverter(KoColor c){
QColor col;
if (m_d->displayRenderer && m_d->displayRenderer->getPaintingColorSpace()==m_d->cs) {
KoColor color = c;
if (m_d->displayRenderer) {
color.convertTo(m_d->displayRenderer->getPaintingColorSpace());
col = m_d->displayRenderer->toQColor(c);
} else {
col = c.toQColor();
......@@ -576,7 +578,6 @@ KoColor KisVisualColorSelectorShape::convertShapeCoordinateToKoColor(QPointF coo
QVector <qreal> maxvalue(c.colorSpace()->channelCount());
maxvalue.fill(1.0);
if (m_d->displayRenderer
&& m_d->displayRenderer->getPaintingColorSpace()==m_d->cs
&& (m_d->cs->colorDepthId() == Float16BitsColorDepthID
|| m_d->cs->colorDepthId() == Float32BitsColorDepthID
|| m_d->cs->colorDepthId() == Float64BitsColorDepthID)
......@@ -695,7 +696,6 @@ QPointF KisVisualColorSelectorShape::convertKoColorToShapeCoordinate(KoColor c)
QVector <qreal> maxvalue(c.colorSpace()->channelCount());
maxvalue.fill(1.0);
if (m_d->displayRenderer
&& m_d->displayRenderer->getPaintingColorSpace()==m_d->cs
&& (m_d->cs->colorDepthId() == Float16BitsColorDepthID
|| m_d->cs->colorDepthId() == Float32BitsColorDepthID
|| m_d->cs->colorDepthId() == Float64BitsColorDepthID)
......
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