diff options
| author | JiDe Zhang <zhangjide@uniontech.com> | 2022-04-09 21:35:00 +0800 |
|---|---|---|
| committer | JiDe Zhang <zhangjide@uniontech.com> | 2022-05-03 12:14:41 +0800 |
| commit | bcc0f4fb1c47aea84d14fcecf51ce137904851df (patch) | |
| tree | 4c6343c38768cf784a46903723efea725c8ad3fa /src/quick/items/qquickrendertarget.cpp | |
| parent | 8a781d9e2429814edf41bd3213b449c9d8f8bc13 (diff) | |
Add setMirrorVertically for QQuickRenderTarget
Allow control the matrix transform of a render target in the
QQuickWindowPrivate::renderSceneGraph.
[ChangeLog][QtQuick][QQuickRenderTarget] Added QQuickRenderTarget::setMirrorVertically,
Allowed to control the mirror vertically of render target.
Task-number: QTBUG-102317
Change-Id: Ifc9aac77f28200594297ea15d07f41a864130f58
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/items/qquickrendertarget.cpp')
| -rw-r--r-- | src/quick/items/qquickrendertarget.cpp | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/quick/items/qquickrendertarget.cpp b/src/quick/items/qquickrendertarget.cpp index 317acddf71..f45a878ae7 100644 --- a/src/quick/items/qquickrendertarget.cpp +++ b/src/quick/items/qquickrendertarget.cpp @@ -66,7 +66,8 @@ QQuickRenderTargetPrivate::QQuickRenderTargetPrivate(const QQuickRenderTargetPri pixelSize(other->pixelSize), devicePixelRatio(other->devicePixelRatio), sampleCount(other->sampleCount), - u(other->u) + u(other->u), + mirrorVertically(other->mirrorVertically) { } @@ -160,6 +161,41 @@ void QQuickRenderTarget::setDevicePixelRatio(qreal ratio) } /*! + \return Returns whether the render target is mirrored vertically. + + The default value is \c {false}. + + \since 6.4 + + \sa setMirrorVertically() +*/ +bool QQuickRenderTarget::mirrorVertically() const +{ + return d->mirrorVertically; +} + + +/*! + Sets the size of the render target contents should be mirrored vertically to + \a enable when drawing. This allows easy integration of third-party rendering + code that does not follow the standard expectations. + + \note This function should not be used when using the \c software backend. + + \since 6.4 + + \sa mirrorVertically() + */ +void QQuickRenderTarget::setMirrorVertically(bool enable) +{ + if (d->mirrorVertically == enable) + return; + + detach(); + d->mirrorVertically = enable; +} + +/*! \return a new QQuickRenderTarget referencing an OpenGL texture object specified by \a textureId. @@ -465,7 +501,8 @@ bool QQuickRenderTarget::isEqual(const QQuickRenderTarget &other) const noexcept if (d->type != other.d->type || d->pixelSize != other.d->pixelSize || d->devicePixelRatio != other.d->devicePixelRatio - || d->sampleCount != other.d->sampleCount) + || d->sampleCount != other.d->sampleCount + || d->mirrorVertically != other.d->mirrorVertically) { return false; } |
