From 92cc1f354b047d601c83f44130d788c397cea205 Mon Sep 17 00:00:00 2001 From: nuuls Date: Sun, 7 Jan 2018 23:26:11 +0100 Subject: [PATCH] fixed scaling issue on mac and compilation issue --- src/singletons/fontmanager.cpp | 16 +++++++++------- src/widgets/helper/channelview.cpp | 27 +++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/singletons/fontmanager.cpp b/src/singletons/fontmanager.cpp index 8522363c8..3952976c6 100644 --- a/src/singletons/fontmanager.cpp +++ b/src/singletons/fontmanager.cpp @@ -4,14 +4,16 @@ #include #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 { diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp index 21d72b2f2..8b34289a7 100644 --- a/src/widgets/helper/channelview.cpp +++ b/src/widgets/helper/channelview.cpp @@ -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(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(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 } }