summaryrefslogtreecommitdiff
path: root/components/images/CachingImage.qml
diff options
context:
space:
mode:
authorDavi Ribeiro <104164579+Markus328@users.noreply.github.com>2025-08-05 01:29:11 -0300
committerGitHub <noreply@github.com>2025-08-05 14:29:11 +1000
commite26e1947bf39c90e6010d706d6222d6d9657ef1b (patch)
tree12035f452748fa3dd8c22f9dca4b4d1a5b9f0e51 /components/images/CachingImage.qml
parentlock: fix battery percentage (#340) (diff)
downloadcaelestia-shell-e26e1947bf39c90e6010d706d6222d6d9657ef1b.tar.gz
caelestia-shell-e26e1947bf39c90e6010d706d6222d6d9657ef1b.tar.bz2
caelestia-shell-e26e1947bf39c90e6010d706d6222d6d9657ef1b.zip
internal: use device scaling for image caching (#348)
* internal: fixes image caching (#275) * fixes --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Diffstat (limited to 'components/images/CachingImage.qml')
-rw-r--r--components/images/CachingImage.qml11
1 files changed, 8 insertions, 3 deletions
diff --git a/components/images/CachingImage.qml b/components/images/CachingImage.qml
index 1d42238..01411a1 100644
--- a/components/images/CachingImage.qml
+++ b/components/images/CachingImage.qml
@@ -1,4 +1,5 @@
import qs.utils
+import Quickshell
import Quickshell.Io
import QtQuick
@@ -7,12 +8,16 @@ Image {
property string path
property string hash
- readonly property string cachePath: `${Paths.stringify(Paths.imagecache)}/${hash}@${width}x${height}.png`
+ readonly property string cachePath: `${Paths.stringify(Paths.imagecache)}/${hash}@${effectiveWidth}x${effectiveHeight}.png`
+
+ readonly property real effectiveScale: QsWindow.window?.devicePixelRatio ?? 1
+ readonly property int effectiveWidth: Math.ceil(width * effectiveScale)
+ readonly property int effectiveHeight: Math.ceil(height * effectiveScale)
asynchronous: true
fillMode: Image.PreserveAspectCrop
- sourceSize.width: width
- sourceSize.height: height
+ sourceSize.width: effectiveWidth
+ sourceSize.height: effectiveHeight
onPathChanged: shaProc.exec(["sha256sum", Paths.strip(path)])