Verified Commit 649eda10 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

taskmanager: Use more efficient way to calculate the size of albumArtBackground

Before:
1. width: 2-3 divisions, 1 comparison
2. height: 3-2 divisions, 1 comparison

After:
1. scaleFactor: 2 divisions, 1 comparison
2. width/height: no division or comparison
parent aa437138
......@@ -232,8 +232,9 @@ ColumnLayout {
readonly property Image source: albumArtImage
// Manual implementation of Image.PreserveAspectCrop
width: (source.paintedWidth / source.paintedHeight) <= (hoverHandler.width / hoverHandler.height) ? hoverHandler.width : hoverHandler.height * (source.paintedWidth / source.paintedHeight)
height: (source.paintedWidth / source.paintedHeight) <= (hoverHandler.width / hoverHandler.height) ? hoverHandler.width * (source.paintedHeight / source.paintedWidth) : hoverHandler.height
readonly property real scaleFactor: Math.max(hoverHandler.width / source.paintedWidth, hoverHandler.height / source.paintedHeight)
width: Math.round(source.paintedWidth * scaleFactor)
height: Math.round(source.paintedHeight * scaleFactor)
layer.enabled: true
opacity: 0.25
layer.effect: FastBlur {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment