Skip to content

Commit 148fef9

Browse files
committed
fix: remove redundant devicePixelRatio division in icon scaling
The change removes an unnecessary division by devicePixelRatio when scaling icons. The division was redundant because: 1. The image is already being scaled by multiplying with devicePixelRatio in the next line 2. Keeping both operations would effectively cancel each other out 3. This simplifies the logic while maintaining the same visual result The modification ensures cleaner code without changing the actual behavior, as the final scaled image size remains correct. fix: 移除图标缩放中多余的 devicePixelRatio 除法操作 本次修改移除了图标缩放过程中多余的 devicePixelRatio 除法运算,因为: 1. 下一行代码已经通过乘以 devicePixelRatio 进行图像缩放 2. 同时保留两个操作会相互抵消效果 3. 简化逻辑的同时保持相同的视觉效果 base64的requestedSize是没有被缩放的原始size,不能除缩放 pms: BUG-304699
1 parent 1210222 commit 148fef9

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

src/private/dquickiconimage.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ QImage DQuickIconImagePrivate::requestImageFromBase64(const QString &name, const
5656
QSize icon_size = requestedSize;
5757
if (icon_size.isEmpty()) {
5858
icon_size = image.size();
59-
} else {
60-
icon_size /= devicePixelRatio;
6159
}
6260
image = image.scaled(icon_size * devicePixelRatio, Qt::KeepAspectRatio, Qt::SmoothTransformation);
6361

0 commit comments

Comments
 (0)