mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fixed gif emotes not drawing
This commit is contained in:
parent
40733ca312
commit
9703cf6ad4
|
@ -172,6 +172,9 @@ void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection
|
||||||
painter.fillRect(0, y, pixmap->width(), pixmap->height(), themeManager.messages.disabled);
|
painter.fillRect(0, y, pixmap->width(), pixmap->height(), themeManager.messages.disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw gif emotes
|
||||||
|
this->container.paintAnimatedElements(painter, y);
|
||||||
|
|
||||||
this->bufferValid = true;
|
this->bufferValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,10 +148,17 @@ void MessageLayoutContainer::paintElements(QPainter &painter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageLayoutContainer::paintAnimatedElements(QPainter &painter, int yOffset)
|
||||||
|
{
|
||||||
|
for (const std::unique_ptr<MessageLayoutElement> &element : this->elements) {
|
||||||
|
element->paintAnimated(painter, yOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
||||||
Selection &selection)
|
Selection &selection)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} // namespace layouts
|
} // namespace layouts
|
||||||
}
|
} // namespace messages
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
|
|
||||||
// painting
|
// painting
|
||||||
void paintElements(QPainter &painter);
|
void paintElements(QPainter &painter);
|
||||||
|
void paintAnimatedElements(QPainter &painter, int yOffset);
|
||||||
void paintSelection(QPainter &painter, int messageIndex, Selection &selection);
|
void paintSelection(QPainter &painter, int messageIndex, Selection &selection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -80,5 +81,5 @@ private:
|
||||||
std::vector<std::unique_ptr<MessageLayoutElement>> elements;
|
std::vector<std::unique_ptr<MessageLayoutElement>> elements;
|
||||||
};
|
};
|
||||||
} // namespace layouts
|
} // namespace layouts
|
||||||
}
|
} // namespace messages
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
|
@ -71,12 +71,14 @@ void ImageLayoutElement::paint(QPainter &painter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageLayoutElement::paintAnimated(QPainter &painter)
|
void ImageLayoutElement::paintAnimated(QPainter &painter, int yOffset)
|
||||||
{
|
{
|
||||||
if (this->image.isAnimated()) {
|
if (this->image.isAnimated()) {
|
||||||
if (this->image.getPixmap() != nullptr) {
|
if (this->image.getPixmap() != nullptr) {
|
||||||
// fourtf: make it use qreal values
|
// fourtf: make it use qreal values
|
||||||
painter.drawPixmap(QRectF(this->getRect()), *this->image.getPixmap(), QRectF());
|
QRect rect = this->getRect();
|
||||||
|
rect.moveTop(yOffset);
|
||||||
|
painter.drawPixmap(QRectF(rect), *this->image.getPixmap(), QRectF());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +121,7 @@ void TextLayoutElement::paint(QPainter &painter)
|
||||||
QTextOption(Qt::AlignLeft | Qt::AlignTop));
|
QTextOption(Qt::AlignLeft | Qt::AlignTop));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextLayoutElement::paintAnimated(QPainter &painter)
|
void TextLayoutElement::paintAnimated(QPainter &, int)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
virtual void addCopyTextToString(QString &str, int from = 0, int to = INT_MAX) const = 0;
|
virtual void addCopyTextToString(QString &str, int from = 0, int to = INT_MAX) const = 0;
|
||||||
virtual int getSelectionIndexCount() = 0;
|
virtual int getSelectionIndexCount() = 0;
|
||||||
virtual void paint(QPainter &painter) = 0;
|
virtual void paint(QPainter &painter) = 0;
|
||||||
virtual void paintAnimated(QPainter &painter) = 0;
|
virtual void paintAnimated(QPainter &painter, int yOffset) = 0;
|
||||||
virtual int getMouseOverIndex(const QPoint &abs) = 0;
|
virtual int getMouseOverIndex(const QPoint &abs) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -56,7 +56,7 @@ protected:
|
||||||
virtual void addCopyTextToString(QString &str, int from = 0, int to = INT_MAX) const override;
|
virtual void addCopyTextToString(QString &str, int from = 0, int to = INT_MAX) const override;
|
||||||
virtual int getSelectionIndexCount() override;
|
virtual int getSelectionIndexCount() override;
|
||||||
virtual void paint(QPainter &painter) override;
|
virtual void paint(QPainter &painter) override;
|
||||||
virtual void paintAnimated(QPainter &painter) override;
|
virtual void paintAnimated(QPainter &painter, int yOffset) override;
|
||||||
virtual int getMouseOverIndex(const QPoint &abs) override;
|
virtual int getMouseOverIndex(const QPoint &abs) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -74,7 +74,7 @@ protected:
|
||||||
virtual void addCopyTextToString(QString &str, int from = 0, int to = INT_MAX) const override;
|
virtual void addCopyTextToString(QString &str, int from = 0, int to = INT_MAX) const override;
|
||||||
virtual int getSelectionIndexCount() override;
|
virtual int getSelectionIndexCount() override;
|
||||||
virtual void paint(QPainter &painter) override;
|
virtual void paint(QPainter &painter) override;
|
||||||
virtual void paintAnimated(QPainter &painter) override;
|
virtual void paintAnimated(QPainter &painter, int yOffset) override;
|
||||||
virtual int getMouseOverIndex(const QPoint &abs) override;
|
virtual int getMouseOverIndex(const QPoint &abs) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue