forgotten changes committed
This commit is contained in:
parent
e75445e17d
commit
06a32bf29b
|
@ -12,6 +12,8 @@
|
|||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
#include <private/qquickitem_p.h>
|
||||
#include <private/qquickwindow_p.h>
|
||||
#include <private/qsgrenderer_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
#include <qpa/qplatforminputcontext.h>
|
||||
|
@ -387,6 +389,48 @@ const QSGNode* qskPaintNode( const QQuickItem* item )
|
|||
return QQuickItemPrivate::get( item )->paintNode;
|
||||
}
|
||||
|
||||
const QSGRootNode* qskScenegraphAnchorNode( const QQuickItem* item )
|
||||
{
|
||||
if ( item == nullptr )
|
||||
return nullptr;
|
||||
|
||||
return QQuickItemPrivate::get( item )->rootNode();
|
||||
}
|
||||
|
||||
const QSGRootNode* qskScenegraphAnchorNode( const QQuickWindow* window )
|
||||
{
|
||||
if ( window )
|
||||
{
|
||||
if ( auto renderer = QQuickWindowPrivate::get( window )->renderer )
|
||||
return renderer->rootNode();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void qskSetScenegraphAnchor( QQuickItem* item, bool on )
|
||||
{
|
||||
/*
|
||||
For setting up a subtree renderer ( f.e in QskSceneTexture ) we need
|
||||
to insert a QSGRootNode above the paintNode.
|
||||
|
||||
( In Qt this feature is exlusively used in the Qt/Quick Effects module
|
||||
what lead to the not very intuitive name "refFromEffectItem" )
|
||||
|
||||
refFromEffectItem also allows to insert a opacity node of 0 to
|
||||
hide the subtree from the main renderer by setting its parameter to
|
||||
true. We have QskItemNode to achieve the same.
|
||||
*/
|
||||
if ( item )
|
||||
{
|
||||
auto d = QQuickItemPrivate::get( item );
|
||||
if ( on )
|
||||
d->refFromEffectItem( false );
|
||||
else
|
||||
d->derefFromEffectItem( false );
|
||||
}
|
||||
}
|
||||
|
||||
QSizeF qskEffectiveSizeHint( const QQuickItem* item,
|
||||
Qt::SizeHint whichHint, const QSizeF& constraint )
|
||||
{
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
|
||||
class QskSizePolicy;
|
||||
|
||||
class QQuickItem;
|
||||
class QSGNode;
|
||||
class QSGTransformNode;
|
||||
class QSGRootNode;
|
||||
class QRectF;
|
||||
|
||||
template< typename T > class QList;
|
||||
|
||||
/*
|
||||
|
@ -71,6 +72,10 @@ QSK_EXPORT void qskInputMethodSetVisible( const QQuickItem*, bool );
|
|||
QSK_EXPORT const QSGTransformNode* qskItemNode( const QQuickItem* );
|
||||
QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* );
|
||||
|
||||
QSK_EXPORT const QSGRootNode* qskScenegraphAnchorNode( const QQuickItem* );
|
||||
QSK_EXPORT const QSGRootNode* qskScenegraphAnchorNode( const QQuickWindow* );
|
||||
QSK_EXPORT void qskSetScenegraphAnchor( QQuickItem*, bool on, bool hide = false );
|
||||
|
||||
QSK_EXPORT void qskItemUpdateRecursive( QQuickItem* );
|
||||
|
||||
QSK_EXPORT bool qskGrabMouse( QQuickItem* );
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "QskTreeNode.h"
|
||||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
#include <private/qquickwindow_p.h>
|
||||
#include <private/qsgbatchrenderer_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
|
@ -166,22 +167,25 @@ namespace
|
|||
class QskSceneTexturePrivate final : public QSGTexturePrivate
|
||||
{
|
||||
public:
|
||||
QskSceneTexturePrivate( QskSceneTexture* texture )
|
||||
QskSceneTexturePrivate( const QQuickWindow* window, QskSceneTexture* texture )
|
||||
: QSGTexturePrivate( texture )
|
||||
, devicePixelRatio( window->effectiveDevicePixelRatio() )
|
||||
{
|
||||
context = dynamic_cast< QSGDefaultRenderContext* >(
|
||||
QQuickWindowPrivate::get( window )->context );
|
||||
}
|
||||
|
||||
QRectF rect;
|
||||
qreal devicePixelRatio = 1.0;
|
||||
const qreal devicePixelRatio;
|
||||
|
||||
Renderer* renderer = nullptr;
|
||||
QSGDefaultRenderContext* context = nullptr;
|
||||
};
|
||||
|
||||
QskSceneTexture::QskSceneTexture( QSGRenderContext* context )
|
||||
: Inherited(*( new QskSceneTexturePrivate(this) ) )
|
||||
QskSceneTexture::QskSceneTexture( const QQuickWindow* window )
|
||||
: Inherited(*( new QskSceneTexturePrivate( window, this ) ) )
|
||||
{
|
||||
d_func()->context = static_cast< QSGDefaultRenderContext* >( context );
|
||||
Q_ASSERT( d_func()->context );
|
||||
}
|
||||
|
||||
QskSceneTexture::~QskSceneTexture()
|
||||
|
@ -218,8 +222,8 @@ QRhiTexture* QskSceneTexture::rhiTexture() const
|
|||
return d->renderer ? d->renderer->texture() : nullptr;
|
||||
}
|
||||
|
||||
void QskSceneTexture::render( QSGRootNode* rootNode,
|
||||
QSGTransformNode* finalNode, const QRectF& rect )
|
||||
void QskSceneTexture::render( const QSGRootNode* rootNode,
|
||||
const QSGTransformNode* finalNode, const QRectF& rect )
|
||||
{
|
||||
Q_D( QskSceneTexture );
|
||||
|
||||
|
@ -233,18 +237,14 @@ void QskSceneTexture::render( QSGRootNode* rootNode,
|
|||
d->renderer->setDevicePixelRatio( d->devicePixelRatio );
|
||||
}
|
||||
|
||||
d->renderer->setRootNode( rootNode );
|
||||
d->renderer->setFinalNode( finalNode );
|
||||
d->renderer->setRootNode( const_cast< QSGRootNode* >( rootNode ) );
|
||||
d->renderer->setFinalNode( const_cast< QSGTransformNode* >( finalNode ) );
|
||||
|
||||
d->renderer->setProjection( d->rect );
|
||||
d->renderer->setTextureSize( pixelSize );
|
||||
d->renderer->renderScene();
|
||||
}
|
||||
|
||||
void QskSceneTexture::setDevicePixelRatio( qreal ratio )
|
||||
{
|
||||
d_func()->devicePixelRatio = ratio;
|
||||
}
|
||||
|
||||
QRectF QskSceneTexture::normalizedTextureSubRect() const
|
||||
{
|
||||
return QRectF( 0, 1, 1, -1 );
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#include <qsgtexture.h>
|
||||
|
||||
class QskSceneTexturePrivate;
|
||||
class QSGRenderContext;
|
||||
|
||||
class QSGRootNode;
|
||||
class QSGTransformNode;
|
||||
class QQuickWindow;
|
||||
|
||||
class QSK_EXPORT QskSceneTexture : public QSGTexture // QSGDynamicTexture: TODO ...
|
||||
{
|
||||
|
@ -22,11 +22,10 @@ class QSK_EXPORT QskSceneTexture : public QSGTexture // QSGDynamicTexture: TODO
|
|||
using Inherited = QSGTexture;
|
||||
|
||||
public:
|
||||
QskSceneTexture( QSGRenderContext* );
|
||||
QskSceneTexture( const QQuickWindow* );
|
||||
~QskSceneTexture();
|
||||
|
||||
void setDevicePixelRatio( qreal );
|
||||
void render( QSGRootNode*, QSGTransformNode*, const QRectF& );
|
||||
void render( const QSGRootNode*, const QSGTransformNode*, const QRectF& );
|
||||
|
||||
QSize textureSize() const override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue