[vlc-commits] qml: alter dp() so that it accepts negative values

Fatih Uzunoglu git at videolan.org
Thu Aug 27 12:44:31 CEST 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Mon Jul 27 18:05:36 2020 +0300| [cb0b422a212ddac881d7fafbb2253ef15c8ec5ff] | committer: Pierre Lamot

qml: alter dp() so that it accepts negative values

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cb0b422a212ddac881d7fafbb2253ef15c8ec5ff
---

 modules/gui/qt/style/VLCStyle.qml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/style/VLCStyle.qml b/modules/gui/qt/style/VLCStyle.qml
index f442243b3b..325cddae73 100644
--- a/modules/gui/qt/style/VLCStyle.qml
+++ b/modules/gui/qt/style/VLCStyle.qml
@@ -198,7 +198,14 @@ Item {
     function dp(px, scale) {
         if (typeof scale === "undefined")
             scale = mainInterface.intfScaleFactor
-        return Math.max(1, Math.round(px * scale))
+
+        var scaledPx = Math.round(px * scale)
+        if (scaledPx < 0)
+            return Math.min(-1, scaledPx)
+        else if (scaledPx > 0)
+            return Math.max(1, scaledPx)
+        else // scaledPx == 0
+            return 0
     }
 
     function colWidth(nb) {



More information about the vlc-commits mailing list