diff --git a/Software/src/AbstractLedDevice.cpp b/Software/src/AbstractLedDevice.cpp index 4d249e2c..2df40c69 100644 --- a/Software/src/AbstractLedDevice.cpp +++ b/Software/src/AbstractLedDevice.cpp @@ -112,7 +112,7 @@ void AbstractLedDevice::updateDeviceSettings() All modifications are made over extended 12bit RGB, so \code outColors \endcode will contain 12bit RGB instead of 8bit. */ -void AbstractLedDevice::applyColorModifications(const QList &inColors, QList &outColors) { +void AbstractLedDevice::applyColorModifications(const QList &inColors, QList &outColors, const bool rawColors) { const bool isApplyWBAdjustments = m_wbAdjustments.count() == inColors.count(); @@ -124,9 +124,14 @@ void AbstractLedDevice::applyColorModifications(const QList &inColors, QLi outColors[i].g = qGreen(inColors[i]) * k; outColors[i].b = qBlue(inColors[i]) * k; - PrismatikMath::gammaCorrection(m_gamma, outColors[i]); + if (!rawColors) + PrismatikMath::gammaCorrection(m_gamma, outColors[i]); } + // we can't completely bypass this function because of the Qrgb / StructRgb conversion above + if (rawColors) + return; + const StructLab avgColor = PrismatikMath::toLab(PrismatikMath::avgColor(outColors)); const double ampCoef = m_ledMilliAmps / (4095.0 * 3.0) / 1000.0; diff --git a/Software/src/AbstractLedDevice.hpp b/Software/src/AbstractLedDevice.hpp index 35b7b4a6..7182b8dc 100644 --- a/Software/src/AbstractLedDevice.hpp +++ b/Software/src/AbstractLedDevice.hpp @@ -96,7 +96,7 @@ public slots: virtual void setUsbPowerLedDisabled(bool isDisabled); protected: - virtual void applyColorModifications(const QList & inColors, QList & outColors); + virtual void applyColorModifications(const QList & inColors, QList & outColors, const bool rawColors = false); virtual void applyDithering(QList& colors, int colorDepth); protected: diff --git a/Software/src/AbstractLedDeviceUdp.cpp b/Software/src/AbstractLedDeviceUdp.cpp index e60a31fd..2b97ca94 100644 --- a/Software/src/AbstractLedDeviceUdp.cpp +++ b/Software/src/AbstractLedDeviceUdp.cpp @@ -110,7 +110,7 @@ void AbstractLedDeviceUdp::switchOffLeds() blackFrame.reserve(count); for (int i = 0; i < count; i++) blackFrame << 0; - setColors(blackFrame); + setColors(blackFrame, true); } void AbstractLedDeviceUdp::resizeColorsBuffer(int buffSize) diff --git a/Software/src/AbstractLedDeviceUdp.hpp b/Software/src/AbstractLedDeviceUdp.hpp index 5819a9e2..5cadab23 100644 --- a/Software/src/AbstractLedDeviceUdp.hpp +++ b/Software/src/AbstractLedDeviceUdp.hpp @@ -47,6 +47,8 @@ public slots: virtual void setColorDepth(int value); virtual void requestFirmwareVersion(); void switchOffLeds(); + virtual void setColors(const QList & colors, const bool rawColors) = 0; + void setColors(const QList & colors) {setColors(colors, false);}; protected: QByteArray m_writeBufferHeader; diff --git a/Software/src/LedDeviceDnrgb.cpp b/Software/src/LedDeviceDnrgb.cpp index 92c82db1..7d8df94e 100644 --- a/Software/src/LedDeviceDnrgb.cpp +++ b/Software/src/LedDeviceDnrgb.cpp @@ -41,15 +41,16 @@ int LedDeviceDnrgb::maxLedsCount() return MaximumNumberOfLeds::Dnrgb; } -void LedDeviceDnrgb::setColors(const QList & colors) +void LedDeviceDnrgb::setColors(const QList & colors, const bool rawColors) { bool ok = true; bool sentPackets = false; resizeColorsBuffer(colors.count()); - applyColorModifications(colors, m_colorsBuffer); - applyDithering(m_colorsBuffer, 8); + applyColorModifications(colors, m_colorsBuffer, rawColors); + if (!rawColors) + applyDithering(m_colorsBuffer, 8); // Send multiple buffers const int totalColorsSaved = m_processedColorsSaved.count(); diff --git a/Software/src/LedDeviceDnrgb.hpp b/Software/src/LedDeviceDnrgb.hpp index c229cb23..cf379595 100644 --- a/Software/src/LedDeviceDnrgb.hpp +++ b/Software/src/LedDeviceDnrgb.hpp @@ -37,7 +37,7 @@ class LedDeviceDnrgb : public AbstractLedDeviceUdp int maxLedsCount(); public slots: - void setColors(const QList & colors); + void setColors(const QList & colors, const bool rawColors); protected: virtual void reinitBufferHeader(); diff --git a/Software/src/LedDeviceDrgb.cpp b/Software/src/LedDeviceDrgb.cpp index d9b7bef7..68acfc4d 100644 --- a/Software/src/LedDeviceDrgb.cpp +++ b/Software/src/LedDeviceDrgb.cpp @@ -41,14 +41,15 @@ int LedDeviceDrgb::maxLedsCount() return MaximumNumberOfLeds::Drgb; } -void LedDeviceDrgb::setColors(const QList & colors) +void LedDeviceDrgb::setColors(const QList & colors, const bool rawColors) { m_colorsSaved = colors; resizeColorsBuffer(colors.count()); - applyColorModifications(colors, m_colorsBuffer); - applyDithering(m_colorsBuffer, 8); + applyColorModifications(colors, m_colorsBuffer, rawColors); + if (!rawColors) + applyDithering(m_colorsBuffer, 8); m_writeBuffer.clear(); m_writeBuffer.reserve(m_writeBuffer.count() + m_colorsBuffer.count() * sizeof(char)); diff --git a/Software/src/LedDeviceDrgb.hpp b/Software/src/LedDeviceDrgb.hpp index 4db115d8..ab6359fb 100644 --- a/Software/src/LedDeviceDrgb.hpp +++ b/Software/src/LedDeviceDrgb.hpp @@ -37,7 +37,7 @@ class LedDeviceDrgb : public AbstractLedDeviceUdp int maxLedsCount(); public slots: - void setColors(const QList & colors); + void setColors(const QList & colors, const bool rawColors); protected: virtual void reinitBufferHeader(); diff --git a/Software/src/LedDeviceWarls.cpp b/Software/src/LedDeviceWarls.cpp index 8598a14e..6f894398 100644 --- a/Software/src/LedDeviceWarls.cpp +++ b/Software/src/LedDeviceWarls.cpp @@ -41,12 +41,13 @@ int LedDeviceWarls::maxLedsCount() return MaximumNumberOfLeds::Warls; } -void LedDeviceWarls::setColors(const QList & colors) +void LedDeviceWarls::setColors(const QList & colors, const bool rawColors) { resizeColorsBuffer(colors.count()); - applyColorModifications(colors, m_colorsBuffer); - applyDithering(m_colorsBuffer, 8); + applyColorModifications(colors, m_colorsBuffer, rawColors); + if (!rawColors) + applyDithering(m_colorsBuffer, 8); const int totalColorsSaved = m_processedColorsSaved.count(); m_writeBuffer.clear(); diff --git a/Software/src/LedDeviceWarls.hpp b/Software/src/LedDeviceWarls.hpp index 21528924..eb9d290b 100644 --- a/Software/src/LedDeviceWarls.hpp +++ b/Software/src/LedDeviceWarls.hpp @@ -37,7 +37,7 @@ class LedDeviceWarls : public AbstractLedDeviceUdp int maxLedsCount(); public slots: - void setColors(const QList & colors); + void setColors(const QList & colors, const bool rawColors); protected: virtual void reinitBufferHeader();