mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-24 15:34:20 +00:00
Fix icon pixmap sizes on Retina with scaling.
This commit is contained in:
parent
2a3a38531b
commit
a5e6890b77
@ -30,24 +30,25 @@ QImage createIconMask(const IconMask *mask, int scale) {
|
|||||||
// images are layouted like this:
|
// images are layouted like this:
|
||||||
// 100x 200x
|
// 100x 200x
|
||||||
// 300x
|
// 300x
|
||||||
scale *= cIntRetinaFactor();
|
const auto factor = cIntRetinaFactor();
|
||||||
|
const auto realscale = scale * factor;
|
||||||
const auto width = maskImage.width() / 3;
|
const auto width = maskImage.width() / 3;
|
||||||
const auto height = maskImage.height() / 5;
|
const auto height = maskImage.height() / 5;
|
||||||
const auto one = QRect(0, 0, width, height);
|
const auto one = QRect(0, 0, width, height);
|
||||||
const auto two = QRect(width, 0, width * 2, height * 2);
|
const auto two = QRect(width, 0, width * 2, height * 2);
|
||||||
const auto three = QRect(0, height * 2, width * 3, height * 3);
|
const auto three = QRect(0, height * 2, width * 3, height * 3);
|
||||||
if (scale == 100) {
|
if (realscale == 100) {
|
||||||
return maskImage.copy(one);
|
return maskImage.copy(one);
|
||||||
} else if (scale == 200) {
|
} else if (realscale == 200) {
|
||||||
return maskImage.copy(two);
|
return maskImage.copy(two);
|
||||||
} else if (scale == 300) {
|
} else if (realscale == 300) {
|
||||||
return maskImage.copy(three);
|
return maskImage.copy(three);
|
||||||
}
|
}
|
||||||
return maskImage.copy(
|
return maskImage.copy(
|
||||||
(scale > 200) ? three : two
|
(realscale > 200) ? three : two
|
||||||
).scaled(
|
).scaled(
|
||||||
ConvertScale(width, scale),
|
ConvertScale(width, scale) * factor,
|
||||||
ConvertScale(height, scale),
|
ConvertScale(height, scale) * factor,
|
||||||
Qt::IgnoreAspectRatio,
|
Qt::IgnoreAspectRatio,
|
||||||
Qt::SmoothTransformation);
|
Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user