fixed redraw issue

This commit is contained in:
fourtf 2018-12-02 19:20:14 +01:00
parent fa24a2acd0
commit bd8fab7e68
6 changed files with 14 additions and 9 deletions

View file

@ -101,6 +101,8 @@ bool MessageLayout::layout(int width, float scale, MessageElementFlags flags)
void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags)
{
this->layoutCount_++;
auto messageFlags = this->message_->flags;
if (this->flags.has(MessageLayoutFlag::Expanded) ||
@ -248,7 +250,7 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
// draw message
this->container_->paintElements(painter);
#ifdef FOURTF
//#ifdef FOURTF
// debug
painter.setPen(QColor(255, 0, 0));
painter.drawRect(buffer->rect().x(), buffer->rect().y(),
@ -257,9 +259,11 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
QTextOption option;
option.setAlignment(Qt::AlignRight | Qt::AlignTop);
painter.drawText(QRectF(1, 1, this->container.getWidth() - 3, 1000),
QString::number(++this->bufferUpdatedCount), option);
#endif
painter.drawText(QRectF(1, 1, this->container_->getWidth() - 3, 1000),
QString::number(this->layoutCount_) + ", " +
QString::number(++this->bufferUpdatedCount_),
option);
//#endif
}
void MessageLayout::invalidateBuffer()

View file

@ -75,6 +75,7 @@ private:
int currentLayoutWidth_ = -1;
int layoutState_ = -1;
float scale_ = -1;
unsigned int layoutCount_ = 0;
unsigned int bufferUpdatedCount_ = 0;
MessageElementFlags currentWordFlags_;

View file

@ -1,6 +1,6 @@
#pragma once
#include "ABSettings.hpp"
#include "BaseSettings.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "controllers/moderationactions/ModerationAction.hpp"

View file

@ -21,7 +21,7 @@ Theme::Theme()
// multiplier: 1 = white, 0.8 = light, -0.8 dark, -1 black
void Theme::actuallyUpdate(double hue, double multiplier)
{
ABTheme::actuallyUpdate(hue, multiplier);
BaseTheme::actuallyUpdate(hue, multiplier);
auto getColor = [multiplier](double h, double s, double l, double a = 1.0) {
return QColor::fromHslF(h, s, ((l - 0.5) * multiplier) + 0.5, a);

View file

@ -1,6 +1,6 @@
#pragma once
#include "ABTheme.hpp"
#include "BaseTheme.hpp"
#include "common/Singleton.hpp"
#include "util/RapidJsonSerializeQString.hpp"
@ -13,7 +13,7 @@ namespace chatterino {
class WindowManager;
class Theme final : public Singleton, public ABTheme
class Theme final : public Singleton, public BaseTheme
{
public:
Theme();

View file

@ -352,7 +352,7 @@ void ChannelView::layoutVisibleMessages(
auto y = int(-(messages[start]->getHeight() *
(fmod(this->scrollBar_->getCurrentValue(), 1))));
for (auto i = start; i < messages.size() && y >= this->height(); i++)
for (auto i = start; i < messages.size() && y <= this->height(); i++)
{
auto message = messages[i];