From e26e1947bf39c90e6010d706d6222d6d9657ef1b Mon Sep 17 00:00:00 2001 From: Davi Ribeiro <104164579+Markus328@users.noreply.github.com> Date: Tue, 5 Aug 2025 01:29:11 -0300 Subject: 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> --- components/images/CachingImage.qml | 11 ++++++++--- 1 file 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)]) -- cgit v1.2.3-freya