summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/3dstudioruntime2/layersinquick/main.qml2
-rw-r--r--src/runtime/profileui/q3dsimguiitem.cpp18
-rw-r--r--src/runtime/profileui/q3dsimguiitem_p.h5
3 files changed, 15 insertions, 10 deletions
diff --git a/examples/3dstudioruntime2/layersinquick/main.qml b/examples/3dstudioruntime2/layersinquick/main.qml
index c37de69..abd1422 100644
--- a/examples/3dstudioruntime2/layersinquick/main.qml
+++ b/examples/3dstudioruntime2/layersinquick/main.qml
@@ -207,6 +207,6 @@ Rectangle {
visible: false
focus: true
anchors.fill: parent
- anchors.margins: 40
+ anchors.topMargin: 40 // make sure we do not cover the top area with the buttons
}
}
diff --git a/src/runtime/profileui/q3dsimguiitem.cpp b/src/runtime/profileui/q3dsimguiitem.cpp
index 40f55c6..63c0f8a 100644
--- a/src/runtime/profileui/q3dsimguiitem.cpp
+++ b/src/runtime/profileui/q3dsimguiitem.cpp
@@ -210,10 +210,10 @@ void Q3DSQuickImGuiRenderer::render(const RenderState *state)
setupVertAttrs();
for (const FrameDesc::Cmd &cmd : e.cmds) {
- qreal sx = cmd.scissorBottomLeft.x() + m_scenePos.x();
- qreal sy = cmd.scissorBottomLeft.y() + m_scenePos.y();
- qreal sw = cmd.scissorSize.width();
- qreal sh = cmd.scissorSize.height();
+ qreal sx = cmd.scissorBottomLeft.x() + m_scenePixelPosBottomLeft.x();
+ qreal sy = cmd.scissorBottomLeft.y() + m_scenePixelPosBottomLeft.y();
+ qreal sw = qMin(cmd.scissorSize.width(), m_pixelSize.width());
+ qreal sh = qMin(cmd.scissorSize.height(), m_pixelSize.height());
if (state->scissorEnabled()) { // when the item has clip: true
const QRectF r = state->scissorRect(); // bottom-left already
sx = qMax(sx, r.x());
@@ -245,7 +245,7 @@ QSGRenderNode::RenderingFlags Q3DSQuickImGuiRenderer::flags() const
QRectF Q3DSQuickImGuiRenderer::rect() const
{
- return QRect(0, 0, m_localSize.width(), m_localSize.height());
+ return QRect(0, 0, m_itemSize.width(), m_itemSize.height());
}
Q3DSImGuiItem::Q3DSImGuiItem(QQuickItem *parent)
@@ -271,8 +271,12 @@ QSGNode *Q3DSImGuiItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNo
// This is on the render thread with the main thread blocked. Synchronize the
// data prepared in the polish step on the main thread.
- n->m_scenePos = mapToScene(QPointF(0, 0));
- n->m_localSize = size();
+ const QPointF sceneTopLeft = mapToScene(QPointF(0, 0));
+ QQuickWindow *w = window();
+ const QSize outputSize = w->renderTargetId() ? w->renderTargetSize() : w->size() * m_dpr;
+ n->m_scenePixelPosBottomLeft = QPointF(sceneTopLeft.x(), outputSize.height() - (sceneTopLeft.y() + height())) * m_dpr;
+ n->m_pixelSize = size() * m_dpr;
+ n->m_itemSize = size();
n->m_frameDesc = m_frameDesc;
n->markDirty(QSGNode::DirtyMaterial);
diff --git a/src/runtime/profileui/q3dsimguiitem_p.h b/src/runtime/profileui/q3dsimguiitem_p.h
index fbc2103..f6c9da7 100644
--- a/src/runtime/profileui/q3dsimguiitem_p.h
+++ b/src/runtime/profileui/q3dsimguiitem_p.h
@@ -86,8 +86,9 @@ public:
};
private:
- QPointF m_scenePos;
- QSizeF m_localSize;
+ QPointF m_scenePixelPosBottomLeft;
+ QSizeF m_pixelSize;
+ QSizeF m_itemSize;
FrameDesc m_frameDesc;
QVector<QOpenGLTexture *> m_textures;
QOpenGLShaderProgram *m_program = nullptr;