diff options
Diffstat (limited to 'examples/quick/scenegraph/rendernode')
-rw-r--r-- | examples/quick/scenegraph/rendernode/main.cpp | 16 | ||||
-rw-r--r-- | examples/quick/scenegraph/rendernode/softwarerenderer.cpp | 7 |
2 files changed, 19 insertions, 4 deletions
diff --git a/examples/quick/scenegraph/rendernode/main.cpp b/examples/quick/scenegraph/rendernode/main.cpp index d6c1b000c3..21419abfc9 100644 --- a/examples/quick/scenegraph/rendernode/main.cpp +++ b/examples/quick/scenegraph/rendernode/main.cpp @@ -48,6 +48,8 @@ ** ****************************************************************************/ +#include <QCommandLineParser> +#include <QCommandLineOption> #include <QGuiApplication> #include <QQuickView> #include "customrenderitem.h" @@ -60,7 +62,19 @@ int main(int argc, char **argv) QQuickView view; - if (QCoreApplication::arguments().contains(QStringLiteral("--multisample"))) { + QCoreApplication::setApplicationName("Qt Scene Graph Render Node Example"); + QCoreApplication::setOrganizationName("QtProject"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::applicationName()); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption multipleSampleOption("multisample", "Multisampling"); + parser.addOption(multipleSampleOption); + + parser.process(app); + + if (parser.isSet(multipleSampleOption)) { QSurfaceFormat fmt; fmt.setSamples(4); view.setFormat(fmt); diff --git a/examples/quick/scenegraph/rendernode/softwarerenderer.cpp b/examples/quick/scenegraph/rendernode/softwarerenderer.cpp index f1c496e23a..b6f7ffa577 100644 --- a/examples/quick/scenegraph/rendernode/softwarerenderer.cpp +++ b/examples/quick/scenegraph/rendernode/softwarerenderer.cpp @@ -74,11 +74,12 @@ void SoftwareRenderNode::render(const RenderState *renderState) QPainter *p = static_cast<QPainter *>(rif->getResource(m_item->window(), QSGRendererInterface::PainterResource)); Q_ASSERT(p); - p->setTransform(matrix()->toTransform()); - p->setOpacity(inheritedOpacity()); const QRegion *clipRegion = renderState->clipRegion(); if (clipRegion && !clipRegion->isEmpty()) - p->setClipRegion(*clipRegion, Qt::IntersectClip); + p->setClipRegion(*clipRegion, Qt::ReplaceClip); // must be done before setTransform + + p->setTransform(matrix()->toTransform()); + p->setOpacity(inheritedOpacity()); const QPointF p0(m_item->width() - 1, m_item->height() - 1); const QPointF p1(0, 0); |