Multiply source size by scale factor

Might be unnecessary, but docs are unclear on that.
This commit is contained in:
Nicolas Werner 2021-12-13 19:09:03 +01:00
parent 9b9d4bec70
commit a0699f5247
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
7 changed files with 20 additions and 16 deletions

View file

@ -5,6 +5,7 @@
import "./ui" import "./ui"
import QtQuick 2.6 import QtQuick 2.6
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Window 2.15
import im.nheko 1.0 import im.nheko 1.0
Rectangle { Rectangle {
@ -67,8 +68,8 @@ Rectangle {
fillMode: avatar.crop ? Image.PreserveAspectCrop : Image.PreserveAspectFit fillMode: avatar.crop ? Image.PreserveAspectCrop : Image.PreserveAspectFit
mipmap: true mipmap: true
smooth: true smooth: true
sourceSize.width: avatar.width sourceSize.width: avatar.width * Screen.devicePixelRatio
sourceSize.height: avatar.height sourceSize.height: avatar.height * Screen.devicePixelRatio
source: avatar.url ? (avatar.url + "?radius=" + (Settings.avatarCircles ? 100 : 25) + ((avatar.crop) ? "" : "&scale")) : "" source: avatar.url ? (avatar.url + "?radius=" + (Settings.avatarCircles ? 100 : 25) + ((avatar.crop) ? "" : "&scale")) : ""
MouseArea { MouseArea {

View file

@ -4,6 +4,7 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Window 2.15
import im.nheko 1.0 import im.nheko 1.0
Image { Image {
@ -30,8 +31,8 @@ Image {
width: 16 width: 16
height: 16 height: 16
sourceSize.height: height sourceSize.height: height * Screen.devicePixelRatio
sourceSize.width: width sourceSize.width: width * Screen.devicePixelRatio
source: { source: {
if (encrypted) { if (encrypted) {
switch (trust) { switch (trust) {

View file

@ -167,8 +167,8 @@ Item {
Layout.preferredWidth: 16 Layout.preferredWidth: 16
height: 16 height: 16
width: 16 width: 16
sourceSize.width: 16 sourceSize.width: 16 * Screen.devicePixelRatio
sourceSize.height: 16 sourceSize.height: 16 * Screen.devicePixelRatio
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText) source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText)
ToolTip.visible: editHovered.hovered ToolTip.visible: editHovered.hovered
ToolTip.text: qsTr("Edited") ToolTip.text: qsTr("Edited")

View file

@ -6,6 +6,7 @@ import Qt.labs.platform 1.1 as Platform
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QtQuick.Window 2.15
import im.nheko 1.0 import im.nheko 1.0
import "./delegates" import "./delegates"
@ -133,8 +134,8 @@ Rectangle {
Layout.rowSpan: 2 Layout.rowSpan: 2
Layout.preferredHeight: Nheko.avatarSize - Nheko.paddingMedium Layout.preferredHeight: Nheko.avatarSize - Nheko.paddingMedium
Layout.preferredWidth: Nheko.avatarSize - Nheko.paddingMedium Layout.preferredWidth: Nheko.avatarSize - Nheko.paddingMedium
sourceSize.height: Layout.preferredHeight sourceSize.height: Layout.preferredHeight * Screen.devicePixelRatio
sourceSize.width: Layout.preferredWidth sourceSize.width: Layout.preferredWidth * Screen.devicePixelRatio
visible: isEncrypted visible: isEncrypted
encrypted: isEncrypted encrypted: isEncrypted
trust: trustlevel trust: trustlevel

View file

@ -32,8 +32,8 @@ Item {
source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + Nheko.colors.buttonText) source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + Nheko.colors.buttonText)
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.width: parent.width sourceSize.width: parent.width * Screen.devicePixelRatio
sourceSize.height: parent.height sourceSize.height: parent.height * Screen.devicePixelRatio
} }
Image { Image {
@ -47,8 +47,8 @@ Item {
smooth: true smooth: true
mipmap: true mipmap: true
sourceSize.width: Math.min(Screen.desktopAvailableWidth, originalWidth || undefined) sourceSize.width: Math.min(Screen.desktopAvailableWidth, originalWidth || undefined) * Screen.devicePixelRatio
sourceSize.height: Math.min(Screen.desktopAvailableHeight, originalWidth*proportionalHeight || undefined) sourceSize.height: Math.min(Screen.desktopAvailableHeight, originalWidth*proportionalHeight || undefined) * Screen.devicePixelRatio
} }
MxcAnimatedImage { MxcAnimatedImage {

View file

@ -305,8 +305,8 @@ ApplicationWindow {
Layout.preferredHeight: 16 Layout.preferredHeight: 16
Layout.preferredWidth: 16 Layout.preferredWidth: 16
visible: profile.isSelf && verificationStatus != VerificationStatus.NOT_APPLICABLE visible: profile.isSelf && verificationStatus != VerificationStatus.NOT_APPLICABLE
sourceSize.height: 16 sourceSize.height: 16 * Screen.devicePixelRatio
sourceSize.width: 16 sourceSize.width: 16 * Screen.devicePixelRatio
source: { source: {
switch (verificationStatus) { switch (verificationStatus) {
case VerificationStatus.VERIFIED: case VerificationStatus.VERIFIED:

View file

@ -7,6 +7,7 @@ import QtGraphicalEffects 1.0
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Window 2.15
import im.nheko 1.0 import im.nheko 1.0
import im.nheko.EmojiModel 1.0 import im.nheko.EmojiModel 1.0
@ -287,8 +288,8 @@ Menu {
horizontalAlignment: Image.AlignHCenter horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter verticalAlignment: Image.AlignVCenter
fillMode: Image.Pad fillMode: Image.Pad
sourceSize.width: 32 sourceSize.width: 32 * Screen.devicePixelRatio
sourceSize.height: 32 sourceSize.height: 32 * Screen.devicePixelRatio
source: "image://colorimage/" + model.image + "?" + (hovered ? Nheko.colors.highlight : Nheko.colors.buttonText) source: "image://colorimage/" + model.image + "?" + (hovered ? Nheko.colors.highlight : Nheko.colors.buttonText)
} }