diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-10-02 10:14:57 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-10-02 09:12:55 +0000 |
commit | 7fb329705494f0cd2448ab1b9d72223e6dbc20b0 (patch) | |
tree | 3b138ce05ec5428af371a098f6b7034634d510e7 /src/core | |
parent | 3257ab9ce01b01b667237fd6ad33512739db5b01 (diff) |
Cleanup scenegraph integration
Get rid of old QSG type names, and also remove redundant setupTiledNode
call.
Change-Id: Ifbd83f6bdc0e029eb52899b20562ef6606f5562b
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/delegated_frame_node.cpp | 55 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt_delegate.h | 5 |
2 files changed, 15 insertions, 45 deletions
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index e1ff2f56c..9805e3333 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -185,10 +185,8 @@ public: virtual void setupRenderPassNode(QSGTexture *, const QRect &, QSGNode *) = 0; virtual void setupTextureContentNode(QSGTexture *, const QRect &, const QRectF &, - QSGTextureNode::TextureCoordinatesTransformMode, + QSGImageNode::TextureCoordinatesTransformMode, QSGNode *) = 0; - virtual void setupTiledContentNode(QSGTexture *, const QRect &, const QRectF &, - QSGNode *) = 0; virtual void setupSolidColorNode(const QRect &, const QColor &, QSGNode *) = 0; #ifndef QT_NO_OPENGL @@ -227,15 +225,18 @@ public: } void setupTextureContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect, - QSGTextureNode::TextureCoordinatesTransformMode texCoordTransForm, + QSGImageNode::TextureCoordinatesTransformMode texCoordTransForm, QSGNode *) override { Q_ASSERT(m_nodeIterator != m_sceneGraphNodes->end()); - QSGTextureNode *textureNode = static_cast<QSGTextureNode*>(*m_nodeIterator++); + QSGImageNode *textureNode = static_cast<QSGImageNode*>(*m_nodeIterator++); if (textureNode->texture() != texture) { + // Chromium sometimes uses textures that doesn't completely fit + // in which case the geometry needs to be recalculated even if + // rect and src-rect matches. + if (textureNode->texture()->textureSize() != texture->textureSize()) + textureNode->markDirty(QSGImageNode::DirtyGeometry); textureNode->setTexture(texture); - // @TODO: This is a workaround for funky rendering, figure out why this is needed. - textureNode->markDirty(QSGTextureNode::DirtyGeometry); } if (textureNode->textureCoordinatesTransform() != texCoordTransForm) textureNode->setTextureCoordinatesTransform(texCoordTransForm); @@ -246,23 +247,6 @@ public: if (textureNode->filtering() != texture->filtering()) textureNode->setFiltering(texture->filtering()); } - void setupTiledContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect, - QSGNode *) override - { - Q_ASSERT(m_nodeIterator != m_sceneGraphNodes->end()); - QSGTextureNode *textureNode = static_cast<QSGTextureNode*>(*m_nodeIterator++); - if (textureNode->texture() != texture) { - textureNode->setTexture(texture); - // @TODO: This is a workaround for funky rendering, figure out why this is needed. - textureNode->markDirty(QSGTextureNode::DirtyGeometry); - } - if (textureNode->rect() != rect) - textureNode->setRect(rect); - if (textureNode->sourceRect() != sourceRect) - textureNode->setSourceRect(sourceRect); - if (textureNode->filtering() != texture->filtering()) - textureNode->setFiltering(texture->filtering()); - } void setupSolidColorNode(const QRect &rect, const QColor &color, QSGNode *) override { Q_ASSERT(m_nodeIterator != m_sceneGraphNodes->end()); @@ -330,10 +314,10 @@ public: } void setupTextureContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect, - QSGTextureNode::TextureCoordinatesTransformMode texCoordTransForm, + QSGImageNode::TextureCoordinatesTransformMode texCoordTransForm, QSGNode *layerChain) override { - QSGTextureNode *textureNode = m_apiDelegate->createTextureNode(); + QSGImageNode *textureNode = m_apiDelegate->createImageNode(); textureNode->setTextureCoordinatesTransform(texCoordTransForm); textureNode->setRect(rect); textureNode->setSourceRect(sourceRect); @@ -344,19 +328,6 @@ public: m_sceneGraphNodes->append(textureNode); } - void setupTiledContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect, - QSGNode *layerChain) override - { - QSGTextureNode *textureNode = m_apiDelegate->createTextureNode(); - textureNode->setRect(rect); - textureNode->setSourceRect(sourceRect); - textureNode->setFiltering(texture->filtering()); - textureNode->setTexture(texture); - - layerChain->appendChildNode(textureNode); - m_sceneGraphNodes->append(textureNode); - } - void setupSolidColorNode(const QRect &rect, const QColor &color, QSGNode *layerChain) override { @@ -1124,7 +1095,7 @@ void DelegatedFrameNode::handleQuad( nodeHandler->setupTextureContentNode( texture, toQt(quad->rect), toQt(uv_rect), - tquad->y_flipped ? QSGTextureNode::MirrorVertically : QSGTextureNode::NoTransform, + tquad->y_flipped ? QSGImageNode::MirrorVertically : QSGImageNode::NoTransform, currentLayerChain); break; } @@ -1164,10 +1135,10 @@ void DelegatedFrameNode::handleQuad( case viz::DrawQuad::TILED_CONTENT: { const viz::TileDrawQuad *tquad = viz::TileDrawQuad::MaterialCast(quad); ResourceHolder *resource = findAndHoldResource(tquad->resource_id(), resourceCandidates); - nodeHandler->setupTiledContentNode( + nodeHandler->setupTextureContentNode( initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate), toQt(quad->rect), toQt(tquad->tex_coord_rect), - currentLayerChain); + QSGImageNode::NoTransform, currentLayerChain); break; #ifndef QT_NO_OPENGL } diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h index 72f54dcb6..8936ce63e 100644 --- a/src/core/render_widget_host_view_qt_delegate.h +++ b/src/core/render_widget_host_view_qt_delegate.h @@ -67,7 +67,6 @@ class QInputMethodEvent; class QSGInternalImageNode; class QSGImageNode; -typedef QSGImageNode QSGTextureNode; QT_END_NAMESPACE @@ -106,8 +105,8 @@ public: virtual QWindow* window() const = 0; virtual QSGTexture *createTextureFromImage(const QImage &) = 0; virtual QSGLayer *createLayer() = 0; - virtual QSGInternalImageNode *createImageNode() = 0; - virtual QSGTextureNode *createTextureNode() = 0; + virtual QSGInternalImageNode *createInternalImageNode() = 0; + virtual QSGImageNode *createImageNode() = 0; virtual QSGRectangleNode *createRectangleNode() = 0; virtual void update() = 0; virtual void updateCursor(const QCursor &) = 0; |