Skip to content

Commit

Permalink
QML WaveformOverviewMarker: optimize position update
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Oct 9, 2021
1 parent eb029c5 commit 95d7af3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion res/qml/Mixxx/Controls/WaveformOverviewMarker.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Mixxx 0.1 as Mixxx
import QtQuick 2.12
import QtQuick.Shapes 1.12
import QtQuick.Window 2.12

Item {
id: root
Expand Down Expand Up @@ -42,7 +43,10 @@ Item {

group: root.group
key: root.key
onValueChanged: marker.x = parent.width * value
onValueChanged: {
// Math.round saves tons of CPU by avoiding redrawing for fractional pixel positions.
marker.x = Math.round(parent.width * value * Screen.devicePixelRatio) / Screen.devicePixelRatio;
}
}

}

0 comments on commit 95d7af3

Please sign in to comment.