[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krita/krita-testing-wolthera] libs/ui/widgets: Check for colorspaces with or not and, a cs can't be
From:       Wolthera van Hovell tot Westerflier <griffinvalley () gmail ! com>
Date:       2016-08-25 9:46:37
Message-ID: E1bcrF7-0000ky-Sd () code ! kde ! org
[Download RAW message or body]

Git commit de26f01fcd4544bffc11947b64e08418666135f2 by Wolthera van Hovell tot \
Westerflier. Committed on 24/08/2016 at 17:20.
Pushed by woltherav into branch 'krita-testing-wolthera'.

Check for colorspaces with or not and, a cs can't be all at the same time.

This fixes floating point from the visual selector shape again. :)

Ref T2438

M  +11   -11   libs/ui/widgets/kis_visual_color_selector.cpp

http://commits.kde.org/krita/de26f01fcd4544bffc11947b64e08418666135f2

diff --git a/libs/ui/widgets/kis_visual_color_selector.cpp \
b/libs/ui/widgets/kis_visual_color_selector.cpp index 3c6f83e..ab013b1 100644
--- a/libs/ui/widgets/kis_visual_color_selector.cpp
+++ b/libs/ui/widgets/kis_visual_color_selector.cpp
@@ -538,16 +538,16 @@ KoColor \
KisVisualColorSelectorShape::convertShapeCoordinateToKoColor(QPointF coo  \
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
+            && (m_d->cs->colorDepthId() == Float16BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float32BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float64BitsColorDepthID)
             && m_d->cs->colorModelId() != LABAColorModelID
             && m_d->cs->colorModelId() != CMYKAColorModelID) {
         for (int ch = 0; ch<maxvalue.size(); ch++) {
             KoChannelInfo *channel = m_d->cs->channels()[ch];
             maxvalue[ch] = m_d->displayRenderer->maxVisibleFloatValue(channel);
             channelValues[ch] = channelValues[ch]/(maxvalue[ch]);
-            channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(ch, \
m_d->cs->channels())] = qBound((float)0.0,channelValues[ch], (float)1.0); +           \
channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(ch, \
m_d->cs->channels())] = channelValues[ch];  }
     } else {
         for (int i =0; i<channelValues.size();i++) {
@@ -638,7 +638,7 @@ KoColor \
KisVisualColorSelectorShape::convertShapeCoordinateToKoColor(QPointF coo  }
     }
     for (int i=0; i<channelValues.size();i++) {
-        channelValues[i] = \
qBound(0.0,channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(i, \
m_d->cs->channels())]*(maxvalue[i]),1.0); +        channelValues[i] = \
channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(i, \
m_d->cs->channels())]*(maxvalue[i]);  }
     c.colorSpace()->fromNormalisedChannelsValue(c.data(), channelValues);
     return c;
@@ -657,16 +657,16 @@ QPointF \
KisVisualColorSelectorShape::convertKoColorToShapeCoordinate(KoColor c)  \
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
+            && (m_d->cs->colorDepthId() == Float16BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float32BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float64BitsColorDepthID)
             && m_d->cs->colorModelId() != LABAColorModelID
             && m_d->cs->colorModelId() != CMYKAColorModelID) {
         for (int ch = 0; ch<maxvalue.size(); ch++) {
             KoChannelInfo *channel = m_d->cs->channels()[ch];
             maxvalue[ch] = m_d->displayRenderer->maxVisibleFloatValue(channel);
             channelValues[ch] = channelValues[ch]/(maxvalue[ch]);
-            channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(ch, \
m_d->cs->channels())] = qBound((float)0.0,channelValues[ch], (float)1.0); +           \
channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(ch, \
m_d->cs->channels())] = channelValues[ch];  }
     } else {
         for (int i =0; i<channelValues.size();i++) {
@@ -722,9 +722,9 @@ QPointF \
KisVisualColorSelectorShape::convertKoColorToShapeCoordinate(KoColor c)  }
         }
     } else {
-        coordinates.setX(channelValuesDisplay[m_d->channel1]);
+        coordinates.setX(qBound((float)0.0, channelValuesDisplay[m_d->channel1], \
(float)1.0));  if (m_d->dimension == Dimensions::twodimensional) {
-            coordinates.setY(channelValuesDisplay[m_d->channel2]);
+            coordinates.setY(qBound((float)0.0, channelValuesDisplay[m_d->channel2], \
(float)1.0));  }
     }
     return coordinates;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic