fixed scaling issue on mac and compilation issue

This commit is contained in:
nuuls 2018-01-07 23:26:11 +01:00
parent 57974508d3
commit 92cc1f354b
No known key found for this signature in database
GPG key ID: 7A0B673A2D4BF257
2 changed files with 32 additions and 11 deletions

View file

@ -4,14 +4,16 @@
#include <QtGlobal>
#ifdef Q_OS_WIN32
#define DEFAULT_FONT_FAMILY "Segoe UI"
#define DEFAULT_FONT_SIZE 10
#elif Q_OS_MACOS
#define DEFAULT_FONT_FAMILY "Helvetica Neue"
#define DEFAULT_FONT_SIZE 12
#define DEFAULT_FONT_FAMILY "Segoe UI"
#define DEFAULT_FONT_SIZE 10
#else
#define DEFAULT_FONT_FAMILY "Arial"
#define DEFAULT_FONT_SIZE 11
#ifdef Q_OS_MACOS
#define DEFAULT_FONT_FAMILY "Helvetica Neue"
#define DEFAULT_FONT_SIZE 12
#else
#define DEFAULT_FONT_FAMILY "Arial"
#define DEFAULT_FONT_SIZE 11
#endif
#endif
namespace chatterino {

View file

@ -516,7 +516,7 @@ void ChannelView::paintEvent(QPaintEvent * /*event*/)
QPainter painter(this);
// only update gif emotes
#ifndef Q_OS_MAC
#ifndef Q_OS_MACOS
// if (this->onlyUpdateEmotes) {
// this->onlyUpdateEmotes = false;
@ -583,8 +583,18 @@ void ChannelView::drawMessages(QPainter &painter, bool overlays)
bool updateBuffer = false;
if (!buffer) {
buffer =
std::shared_ptr<QPixmap>(new QPixmap(this->width(), messageRef->getHeight()));
QPixmap *pixmap;
#ifdef Q_OS_MACOS
pixmap = new QPixmap(
(int)(this->width() * painter.device()->devicePixelRatioF()),
(int)(messageRef->getHeight() * painter.device()->devicePixelRatioF()));
pixmap->setDevicePixelRatio(painter.device()->devicePixelRatioF());
#else
pixmap = new QPixmap(this->width(), messageRef->getHeight());
#endif
buffer = std::shared_ptr<QPixmap>(pixmap);
updateBuffer = true;
}
@ -617,7 +627,16 @@ void ChannelView::drawMessages(QPainter &painter, bool overlays)
messageRef->buffer = buffer;
if (buffer) {
painter.drawPixmap(0, y, *buffer.get());
//#ifdef Q_OS_MACOS
// painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
// painter.drawPixmap(0, y,
// (int)(buffer->width() / painter.device()->devicePixelRatioF()),
// (int)(buffer->height() / painter.device()->devicePixelRatioF()),
// *buffer.get());
//#else
painter.drawPixmap(0, y, *buffer.get());
//#endif
}
}