mirror of https://github.com/procxx/kepka.git
Fix possible crash with emoji load failure.
This commit is contained in:
parent
b631d09a40
commit
037b936613
|
@ -319,14 +319,14 @@ EmojiImageLoader::EmojiImageLoader(
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage EmojiImageLoader::prepare(EmojiPtr emoji) {
|
QImage EmojiImageLoader::prepare(EmojiPtr emoji) {
|
||||||
_images->ensureLoaded();
|
const auto loaded = _images->ensureLoaded();
|
||||||
const auto factor = cIntRetinaFactor();
|
const auto factor = cIntRetinaFactor();
|
||||||
const auto side = st::largeEmojiSize + 2 * st::largeEmojiOutline;
|
const auto side = st::largeEmojiSize + 2 * st::largeEmojiOutline;
|
||||||
auto tinted = QImage(
|
auto tinted = QImage(
|
||||||
QSize(st::largeEmojiSize, st::largeEmojiSize) * factor,
|
QSize(st::largeEmojiSize, st::largeEmojiSize) * factor,
|
||||||
QImage::Format_ARGB32_Premultiplied);
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
tinted.fill(Qt::white);
|
tinted.fill(Qt::white);
|
||||||
{
|
if (loaded) {
|
||||||
QPainter p(&tinted);
|
QPainter p(&tinted);
|
||||||
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
||||||
_images->draw(
|
_images->draw(
|
||||||
|
@ -340,7 +340,7 @@ QImage EmojiImageLoader::prepare(EmojiPtr emoji) {
|
||||||
QSize(side, side) * factor,
|
QSize(side, side) * factor,
|
||||||
QImage::Format_ARGB32_Premultiplied);
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
result.fill(Qt::transparent);
|
result.fill(Qt::transparent);
|
||||||
{
|
if (loaded) {
|
||||||
QPainter p(&result);
|
QPainter p(&result);
|
||||||
const auto delta = st::largeEmojiOutline * factor;
|
const auto delta = st::largeEmojiOutline * factor;
|
||||||
const auto planar = std::array<QPoint, 4>{ {
|
const auto planar = std::array<QPoint, 4>{ {
|
||||||
|
|
Loading…
Reference in New Issue