summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-misc/qlcplus/files/qlcplus-4.12.5-fix-test-issue.patch')
-rw-r--r--app-misc/qlcplus/files/qlcplus-4.12.5-fix-test-issue.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/app-misc/qlcplus/files/qlcplus-4.12.5-fix-test-issue.patch b/app-misc/qlcplus/files/qlcplus-4.12.5-fix-test-issue.patch
new file mode 100644
index 000000000000..d7cffba6ff8c
--- /dev/null
+++ b/app-misc/qlcplus/files/qlcplus-4.12.5-fix-test-issue.patch
@@ -0,0 +1,59 @@
+From 2ee0e053e39587d29789a26a37309445df222a0c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?=
+ <jeromelebleu@users.noreply.github.com>
+Date: Fri, 8 Jul 2022 09:41:21 +0200
+Subject: [PATCH] Round values explicitly in FadeChannel and KeyPadParser
+
+Fix #1344
+---
+ engine/src/fadechannel.cpp | 9 +++------
+ engine/src/keypadparser.cpp | 6 ++++--
+ 2 files changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/engine/src/fadechannel.cpp b/engine/src/fadechannel.cpp
+index 537b0fd9f..c642360be 100644
+--- a/engine/src/fadechannel.cpp
++++ b/engine/src/fadechannel.cpp
+@@ -323,14 +323,11 @@ uchar FadeChannel::calculateCurrent(uint fadeTime, uint elapsedTime)
+ // 16 bit fading works as long as MSB and LSB channels
+ // are targeting the same value. E.g. Red and Red Fine both at 158
+ float val = (float(m_target - m_start) * (float(elapsedTime) / float(fadeTime))) + float(m_start);
++ long rval = lrintf(val * 256);
+ if (m_flags & Fine)
+- {
+- m_current = ((val - floor(val)) * float(UCHAR_MAX));
+- }
++ m_current = rval & 0xff;
+ else
+- {
+- m_current = val;
+- }
++ m_current = rval / 256;
+ }
+
+ return uchar(m_current);
+diff --git a/engine/src/keypadparser.cpp b/engine/src/keypadparser.cpp
+index bc2d64cbc..36a4fe9b9 100644
+--- a/engine/src/keypadparser.cpp
++++ b/engine/src/keypadparser.cpp
+@@ -17,6 +17,8 @@
+ limitations under the License.
+ */
+
++#include <cmath>
++
+ #include "keypadparser.h"
+ #include "qlcmacros.h"
+
+@@ -194,9 +196,9 @@ QList<SceneValue> KeyPadParser::parseCommand(Doc *doc, QString command,
+ else if (lastCommand == CommandMinus)
+ scv.value = CLAMP(uniValue - toValue, 0, 255);
+ else if (lastCommand == CommandPlusPercent)
+- scv.value = CLAMP(uniValue * (1.0 + toValue), 0, 255);
++ scv.value = CLAMP(lrintf(uniValue * (1.0 + toValue)), 0, 255);
+ else if (lastCommand == CommandMinusPercent)
+- scv.value = CLAMP(uniValue - (float(uniValue) * toValue), 0, 255);
++ scv.value = CLAMP(lrintf(uniValue - (float(uniValue) * toValue)), 0, 255);
+ else if (lastCommand == CommandZERO)
+ scv.value = 0;
+ else if (lastCommand == CommandFULL)