Qt: Improved HiDPI support

This commit is contained in:
Jeffrey Pfau 2017-01-05 00:39:30 -08:00 committed by Vicki Pfau
parent dbbebc4595
commit e9848d87ba
3 changed files with 13 additions and 0 deletions

View File

@ -3,6 +3,8 @@ Bugfixes:
- ARM7: Fix MLA/*MULL/*MLAL timing - ARM7: Fix MLA/*MULL/*MLAL timing
- GBA: Fix multiboot ROM loading - GBA: Fix multiboot ROM loading
- Libretro: Fix saving in GB games (fixes mgba.io/i/486) - Libretro: Fix saving in GB games (fixes mgba.io/i/486)
Misc:
- Qt: Improved HiDPI support
0.5.2: (2016-12-31) 0.5.2: (2016-12-31)
Bugfixes: Bugfixes:

View File

@ -75,7 +75,11 @@ void DisplayGL::startDrawing(mCoreThread* thread) {
lockAspectRatio(isAspectRatioLocked()); lockAspectRatio(isAspectRatioLocked());
filter(isFiltered()); filter(isFiltered());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
messagePainter()->resize(size(), isAspectRatioLocked(), devicePixelRatioF());
#else
messagePainter()->resize(size(), isAspectRatioLocked(), devicePixelRatio()); messagePainter()->resize(size(), isAspectRatioLocked(), devicePixelRatio());
#endif
resizePainter(); resizePainter();
} }
@ -362,7 +366,11 @@ void PainterGL::unpause() {
void PainterGL::performDraw() { void PainterGL::performDraw() {
m_painter.beginNativePainting(); m_painter.beginNativePainting();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
float r = m_gl->devicePixelRatioF();
#else
float r = m_gl->devicePixelRatio(); float r = m_gl->devicePixelRatio();
#endif
m_backend->resized(m_backend, m_size.width() * r, m_size.height() * r); m_backend->resized(m_backend, m_size.width() * r, m_size.height() * r);
m_backend->drawFrame(m_backend); m_backend->drawFrame(m_backend);
m_painter.endNativePainting(); m_painter.endNativePainting();

View File

@ -205,6 +205,9 @@ void Window::argumentsPassed(mArguments* args) {
void Window::resizeFrame(const QSize& size) { void Window::resizeFrame(const QSize& size) {
QSize newSize(size); QSize newSize(size);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
newSize /= m_screenWidget->devicePixelRatioF();
#endif
m_screenWidget->setSizeHint(newSize); m_screenWidget->setSizeHint(newSize);
newSize -= m_screenWidget->size(); newSize -= m_screenWidget->size();
newSize += this->size(); newSize += this->size();