fixed an issue where normal emotes would be redrawn like gif emotes

This commit is contained in:
fourtf 2018-04-06 17:46:12 +02:00
parent 86c844c791
commit cc1e3c2f6f
3 changed files with 16 additions and 1 deletions

View file

@ -75,6 +75,15 @@ void Image::loadImage()
bool first = true; bool first = true;
// clear stuff before loading the image again
lli->allFrames.clear();
if (lli->isAnimated()) {
util::DebugCount::decrease("animated images");
}
if (lli->isLoaded) {
util::DebugCount::decrease("loaded images");
}
for (int index = 0; index < reader.imageCount(); ++index) { for (int index = 0; index < reader.imageCount(); ++index) {
if (reader.read(&image)) { if (reader.read(&image)) {
auto pixmap = new QPixmap(QPixmap::fromImage(image)); auto pixmap = new QPixmap(QPixmap::fromImage(image));

View file

@ -147,6 +147,7 @@ void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection
this->buffer = std::shared_ptr<QPixmap>(pixmap); this->buffer = std::shared_ptr<QPixmap>(pixmap);
this->bufferValid = false; this->bufferValid = false;
util::DebugCount::increase("message drawing buffers");
} }
if (!this->bufferValid || !selection.isEmpty()) { if (!this->bufferValid || !selection.isEmpty()) {
@ -221,8 +222,12 @@ void MessageLayout::invalidateBuffer()
void MessageLayout::deleteBuffer() void MessageLayout::deleteBuffer()
{ {
if (this->buffer != nullptr) {
util::DebugCount::decrease("message drawing buffers");
this->buffer = nullptr; this->buffer = nullptr;
} }
}
// Elements // Elements
// assert(QThread::currentThread() == QApplication::instance()->thread()); // assert(QThread::currentThread() == QApplication::instance()->thread());

View file

@ -105,6 +105,7 @@ void ImageLayoutElement::paintAnimated(QPainter &painter, int yOffset)
} }
if (this->image->isAnimated()) { if (this->image->isAnimated()) {
// qDebug() << this->image->getUrl();
auto pixmap = this->image->getPixmap(); auto pixmap = this->image->getPixmap();
if (pixmap != nullptr) { if (pixmap != nullptr) {