Fix emoji single pixmap size on Retina screens.
This commit is contained in:
parent
7b4114d907
commit
efdb990d96
1 changed files with 6 additions and 5 deletions
|
|
@ -733,7 +733,8 @@ QVector<EmojiPtr> GetDefaultRecent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPixmap &SinglePixmap(EmojiPtr emoji, int fontHeight) {
|
const QPixmap &SinglePixmap(EmojiPtr emoji, int fontHeight) {
|
||||||
auto &map = (fontHeight == st::normalFont->height * style::DevicePixelRatio())
|
const auto factor = style::DevicePixelRatio();
|
||||||
|
auto &map = (fontHeight == st::normalFont->height * factor)
|
||||||
? MainEmojiMap
|
? MainEmojiMap
|
||||||
: OtherEmojiMap[fontHeight];
|
: OtherEmojiMap[fontHeight];
|
||||||
auto i = map.find(emoji->index());
|
auto i = map.find(emoji->index());
|
||||||
|
|
@ -741,10 +742,10 @@ const QPixmap &SinglePixmap(EmojiPtr emoji, int fontHeight) {
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
auto image = QImage(
|
auto image = QImage(
|
||||||
SizeNormal + st::emojiPadding * 2,
|
SizeNormal + st::emojiPadding * factor * 2,
|
||||||
fontHeight,
|
fontHeight,
|
||||||
QImage::Format_ARGB32_Premultiplied);
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
image.setDevicePixelRatio(style::DevicePixelRatio());
|
image.setDevicePixelRatio(factor);
|
||||||
image.fill(Qt::transparent);
|
image.fill(Qt::transparent);
|
||||||
{
|
{
|
||||||
QPainter p(&image);
|
QPainter p(&image);
|
||||||
|
|
@ -753,8 +754,8 @@ const QPixmap &SinglePixmap(EmojiPtr emoji, int fontHeight) {
|
||||||
p,
|
p,
|
||||||
emoji,
|
emoji,
|
||||||
SizeNormal,
|
SizeNormal,
|
||||||
st::emojiPadding * style::DevicePixelRatio(),
|
st::emojiPadding,
|
||||||
(fontHeight - SizeNormal) / 2);
|
(fontHeight - SizeNormal) / (2 * factor));
|
||||||
}
|
}
|
||||||
return map.emplace(
|
return map.emplace(
|
||||||
emoji->index(),
|
emoji->index(),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue