6cfee3deaf
- Add upstream patch support-non-integer-pixel-ratios-qquickwidget.patch * Add support for non-integer scaling to QQuickWidget (QTBUG-61502) OBS-URL: https://build.opensuse.org/request/show/505873 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtdeclarative?expand=0&rev=38
74 lines
3.4 KiB
Diff
74 lines
3.4 KiB
Diff
From dfce0a8feceeb7156eba6ac5d8d3521e3009a583 Mon Sep 17 00:00:00 2001
|
|
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
|
|
Date: Wed, 21 Jun 2017 09:03:22 +0200
|
|
Subject: [PATCH] Support non-integer pixel-ratio in QQuickWidget
|
|
|
|
Non-integer pixel-ratios always resulted in blurry rendering when
|
|
QQuickWidget was used, but not with QQuickWindow. Fixed by reading qreal
|
|
accessor of devicePixelRatio instead.
|
|
|
|
Change-Id: I49f5efcf2da2efc090c00017e68c99c857cd84ef
|
|
Task-number: QTBUG-61502
|
|
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
|
|
---
|
|
src/quickwidgets/qquickwidget.cpp | 14 ++++++++------
|
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
Index: qtdeclarative-opensource-src-5.9.0/src/quickwidgets/qquickwidget.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.0.orig/src/quickwidgets/qquickwidget.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.0/src/quickwidgets/qquickwidget.cpp
|
|
@@ -913,9 +913,9 @@ void QQuickWidget::createFramebufferObje
|
|
d->offscreenWindow->setGeometry(globalPos.x(), globalPos.y(), width(), height());
|
|
|
|
if (d->useSoftwareRenderer) {
|
|
- const QSize imageSize = size() * devicePixelRatio();
|
|
+ const QSize imageSize = size() * devicePixelRatioF();
|
|
d->softwareImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied);
|
|
- d->softwareImage.setDevicePixelRatio(devicePixelRatio());
|
|
+ d->softwareImage.setDevicePixelRatio(devicePixelRatioF());
|
|
return;
|
|
}
|
|
|
|
@@ -960,7 +960,7 @@ void QQuickWidget::createFramebufferObje
|
|
format.setInternalTextureFormat(GL_SRGB8_ALPHA8_EXT);
|
|
#endif
|
|
|
|
- const QSize fboSize = size() * devicePixelRatio();
|
|
+ const QSize fboSize = size() * devicePixelRatioF();
|
|
|
|
// Could be a simple hide - show, in which case the previous fbo is just fine.
|
|
if (!d->fbo || d->fbo->size() != fboSize) {
|
|
@@ -1181,7 +1181,7 @@ void QQuickWidget::resizeEvent(QResizeEv
|
|
// Software Renderer
|
|
if (d->useSoftwareRenderer) {
|
|
needsSync = true;
|
|
- if (d->softwareImage.size() != size() * devicePixelRatio()) {
|
|
+ if (d->softwareImage.size() != size() * devicePixelRatioF()) {
|
|
createFramebufferObject();
|
|
}
|
|
} else {
|
|
@@ -1191,7 +1191,7 @@ void QQuickWidget::resizeEvent(QResizeEv
|
|
// during hide - resize - show sequences and also during application exit.
|
|
if (!d->fbo && !d->offscreenWindow->openglContext())
|
|
return;
|
|
- if (!d->fbo || d->fbo->size() != size() * devicePixelRatio()) {
|
|
+ if (!d->fbo || d->fbo->size() != size() * devicePixelRatioF()) {
|
|
needsSync = true;
|
|
createFramebufferObject();
|
|
}
|
|
@@ -1604,10 +1604,12 @@ void QQuickWidget::paintEvent(QPaintEven
|
|
//Paint everything
|
|
painter.drawImage(rect(), d->softwareImage);
|
|
} else {
|
|
+ QTransform transform;
|
|
+ transform.scale(devicePixelRatioF(), devicePixelRatioF());
|
|
//Paint only the updated areas
|
|
const auto rects = d->updateRegion.rects();
|
|
for (auto targetRect : rects) {
|
|
- auto sourceRect = QRect(targetRect.topLeft() * devicePixelRatio(), targetRect.size() * devicePixelRatio());
|
|
+ auto sourceRect = transform.mapRect(QRectF(targetRect));
|
|
painter.drawImage(targetRect, d->softwareImage, sourceRect);
|
|
}
|
|
d->updateRegion = QRegion();
|