commit:     9cc6eaa77dc60fb031455afae705658c818c94f7
Author:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  4 06:36:45 2022 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Aug  4 06:37:21 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9cc6eaa7

app-misc/qlcplus: add upstream patch to fix a test issue in 4.12.5

Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../files/qlcplus-4.12.5-fix-test-issue.patch      | 59 ++++++++++++++++++++++
 app-misc/qlcplus/qlcplus-4.12.5.ebuild             |  2 +
 2 files changed, 61 insertions(+)

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?=
+ <[email protected]>
+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)

diff --git a/app-misc/qlcplus/qlcplus-4.12.5.ebuild 
b/app-misc/qlcplus/qlcplus-4.12.5.ebuild
index a178db0add32..bdcb55edcf6b 100644
--- a/app-misc/qlcplus/qlcplus-4.12.5.ebuild
+++ b/app-misc/qlcplus/qlcplus-4.12.5.ebuild
@@ -44,6 +44,8 @@ DEPEND="${RDEPEND}
        dev-qt/qttest:5
 "
 
+PATCHES=( "${FILESDIR}"/qlcplus-4.12.5-fix-test-issue.patch )
+
 src_prepare() {
        default
 

Reply via email to