summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem.cpp6
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem_p.h2
-rw-r--r--src/quick3d/imports/scene3d/scene3drenderer.cpp9
3 files changed, 10 insertions, 7 deletions
diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp
index c31f4aa97..ab832d463 100644
--- a/src/quick3d/imports/scene3d/scene3ditem.cpp
+++ b/src/quick3d/imports/scene3d/scene3ditem.cpp
@@ -223,11 +223,13 @@ void Scene3DItem::setWindowSurface(QObject *rootObject)
}
}
-void Scene3DItem::setItemArea(QSize area)
+void Scene3DItem::setItemAreaAndDevicePixelRatio(QSize area, qreal devicePixelRatio)
{
Qt3DRender::QRenderSurfaceSelector *surfaceSelector = Qt3DRender::QRenderSurfaceSelectorPrivate::find(m_entity);
- if (surfaceSelector)
+ if (surfaceSelector) {
surfaceSelector->setExternalRenderTargetSize(area);
+ surfaceSelector->setSurfacePixelRatio(devicePixelRatio);
+ }
}
bool Scene3DItem::isHoverEnabled() const
diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h
index e0ce3addc..37d7cbcc2 100644
--- a/src/quick3d/imports/scene3d/scene3ditem_p.h
+++ b/src/quick3d/imports/scene3d/scene3ditem_p.h
@@ -88,7 +88,7 @@ public:
bool multisample() const;
void setMultisample(bool enable);
- Q_INVOKABLE void setItemArea(QSize area);
+ Q_INVOKABLE void setItemAreaAndDevicePixelRatio(QSize area, qreal devicePixelRatio);
bool isHoverEnabled() const;
enum CameraAspectRatioMode {
diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp
index 26e966f76..23aaf9ed0 100644
--- a/src/quick3d/imports/scene3d/scene3drenderer.cpp
+++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp
@@ -59,9 +59,9 @@ namespace Qt3DRender {
namespace {
-inline QMetaMethod setItemAreaMethod()
+inline QMetaMethod setItemAreaAndDevicePixelRatioMethod()
{
- const int idx = Scene3DItem::staticMetaObject.indexOfMethod("setItemArea(QSize)");
+ const int idx = Scene3DItem::staticMetaObject.indexOfMethod("setItemAreaAndDevicePixelRatio(QSize,qreal)");
Q_ASSERT(idx != -1);
return Scene3DItem::staticMetaObject.method(idx);
}
@@ -267,8 +267,9 @@ void Scene3DRenderer::render()
if (sizeHasChanged) {
// We are in the QSGRenderThread (doing a direct call would result in a race)
- static const QMetaMethod setItemArea = setItemAreaMethod();
- setItemArea.invoke(m_item, Qt::QueuedConnection, Q_ARG(QSize, boundingRectSize));
+ static const QMetaMethod setItemAreaAndDevicePixelRatio = setItemAreaAndDevicePixelRatioMethod();
+ setItemAreaAndDevicePixelRatio.invoke(m_item, Qt::QueuedConnection, Q_ARG(QSize, boundingRectSize),
+ Q_ARG(qreal, window->effectiveDevicePixelRatio()));
}
// Rebuild FBO and textures if never created or a resize has occurred