fixed redraw issue
This commit is contained in:
@@ -101,6 +101,8 @@ bool MessageLayout::layout(int width, float scale, MessageElementFlags flags)
|
|||||||
|
|
||||||
void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags)
|
void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags)
|
||||||
{
|
{
|
||||||
|
this->layoutCount_++;
|
||||||
|
|
||||||
auto messageFlags = this->message_->flags;
|
auto messageFlags = this->message_->flags;
|
||||||
|
|
||||||
if (this->flags.has(MessageLayoutFlag::Expanded) ||
|
if (this->flags.has(MessageLayoutFlag::Expanded) ||
|
||||||
@@ -248,7 +250,7 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
|
|||||||
// draw message
|
// draw message
|
||||||
this->container_->paintElements(painter);
|
this->container_->paintElements(painter);
|
||||||
|
|
||||||
#ifdef FOURTF
|
//#ifdef FOURTF
|
||||||
// debug
|
// debug
|
||||||
painter.setPen(QColor(255, 0, 0));
|
painter.setPen(QColor(255, 0, 0));
|
||||||
painter.drawRect(buffer->rect().x(), buffer->rect().y(),
|
painter.drawRect(buffer->rect().x(), buffer->rect().y(),
|
||||||
@@ -257,9 +259,11 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
|
|||||||
QTextOption option;
|
QTextOption option;
|
||||||
option.setAlignment(Qt::AlignRight | Qt::AlignTop);
|
option.setAlignment(Qt::AlignRight | Qt::AlignTop);
|
||||||
|
|
||||||
painter.drawText(QRectF(1, 1, this->container.getWidth() - 3, 1000),
|
painter.drawText(QRectF(1, 1, this->container_->getWidth() - 3, 1000),
|
||||||
QString::number(++this->bufferUpdatedCount), option);
|
QString::number(this->layoutCount_) + ", " +
|
||||||
#endif
|
QString::number(++this->bufferUpdatedCount_),
|
||||||
|
option);
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLayout::invalidateBuffer()
|
void MessageLayout::invalidateBuffer()
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ private:
|
|||||||
int currentLayoutWidth_ = -1;
|
int currentLayoutWidth_ = -1;
|
||||||
int layoutState_ = -1;
|
int layoutState_ = -1;
|
||||||
float scale_ = -1;
|
float scale_ = -1;
|
||||||
|
unsigned int layoutCount_ = 0;
|
||||||
unsigned int bufferUpdatedCount_ = 0;
|
unsigned int bufferUpdatedCount_ = 0;
|
||||||
|
|
||||||
MessageElementFlags currentWordFlags_;
|
MessageElementFlags currentWordFlags_;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ABSettings.hpp"
|
#include "BaseSettings.hpp"
|
||||||
|
|
||||||
#include "controllers/highlights/HighlightPhrase.hpp"
|
#include "controllers/highlights/HighlightPhrase.hpp"
|
||||||
#include "controllers/moderationactions/ModerationAction.hpp"
|
#include "controllers/moderationactions/ModerationAction.hpp"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Theme::Theme()
|
|||||||
// multiplier: 1 = white, 0.8 = light, -0.8 dark, -1 black
|
// multiplier: 1 = white, 0.8 = light, -0.8 dark, -1 black
|
||||||
void Theme::actuallyUpdate(double hue, double multiplier)
|
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) {
|
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);
|
return QColor::fromHslF(h, s, ((l - 0.5) * multiplier) + 0.5, a);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ABTheme.hpp"
|
#include "BaseTheme.hpp"
|
||||||
#include "common/Singleton.hpp"
|
#include "common/Singleton.hpp"
|
||||||
#include "util/RapidJsonSerializeQString.hpp"
|
#include "util/RapidJsonSerializeQString.hpp"
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ namespace chatterino {
|
|||||||
|
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
|
|
||||||
class Theme final : public Singleton, public ABTheme
|
class Theme final : public Singleton, public BaseTheme
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Theme();
|
Theme();
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ void ChannelView::layoutVisibleMessages(
|
|||||||
auto y = int(-(messages[start]->getHeight() *
|
auto y = int(-(messages[start]->getHeight() *
|
||||||
(fmod(this->scrollBar_->getCurrentValue(), 1))));
|
(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];
|
auto message = messages[i];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user