From 170ff5668f64cab3ddafd694fead1c65cb1ccbfa Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Mon, 15 Apr 2019 17:58:08 +0200 Subject: [PATCH] [FrameSvgItem] Update filtering on smooth changes Summary: When just the smooth property is changed, this also results in a call of QQuickItem::updatePaintNode reimplementations. So always just set the filtering flag to match the current value of the smooth property. Reviewers: #plasma, broulik, mart Reviewed By: #plasma, broulik Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20579 --- src/declarativeimports/core/framesvgitem.cpp | 29 ++++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/declarativeimports/core/framesvgitem.cpp b/src/declarativeimports/core/framesvgitem.cpp index b80c80382..122af1038 100644 --- a/src/declarativeimports/core/framesvgitem.cpp +++ b/src/declarativeimports/core/framesvgitem.cpp @@ -85,14 +85,13 @@ public: Tile }; - FrameItemNode(FrameSvgItem* frameSvg, FrameSvg::EnabledBorders borders, FitMode fitMode, QSGTexture::Filtering filtering, QSGNode* parent) + FrameItemNode(FrameSvgItem* frameSvg, FrameSvg::EnabledBorders borders, FitMode fitMode, QSGNode* parent) : ManagedTextureNode() , m_frameSvg(frameSvg) , m_border(borders) , m_lastParent(parent) , m_fitMode(fitMode) { - setFiltering(filtering); m_lastParent->appendChildNode(this); if (m_fitMode == Tile) { @@ -543,36 +542,42 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile; FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile: FrameItemNode::Stretch; - new FrameItemNode(this, FrameSvg::NoBorder, centerFitMode, filtering, oldNode); + new FrameItemNode(this, FrameSvg::NoBorder, centerFitMode, oldNode); if (enabledBorders() & (FrameSvg::TopBorder | FrameSvg::LeftBorder)) { - new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, filtering, oldNode); + new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, oldNode); } if (enabledBorders() & (FrameSvg::TopBorder | FrameSvg::RightBorder)) { - new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, filtering, oldNode); + new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, oldNode); } if (enabledBorders() & FrameSvg::TopBorder) { - new FrameItemNode(this, FrameSvg::TopBorder, borderFitMode, filtering, oldNode); + new FrameItemNode(this, FrameSvg::TopBorder, borderFitMode, oldNode); } if (enabledBorders() & FrameSvg::BottomBorder) { - new FrameItemNode(this, FrameSvg::BottomBorder, borderFitMode, filtering, oldNode); + new FrameItemNode(this, FrameSvg::BottomBorder, borderFitMode, oldNode); } if (enabledBorders() & (FrameSvg::BottomBorder | FrameSvg::LeftBorder)) { - new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, filtering, oldNode); + new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, oldNode); } if (enabledBorders() & (FrameSvg::BottomBorder | FrameSvg::RightBorder)) { - new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, filtering, oldNode); + new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, oldNode); } if (enabledBorders() & FrameSvg::LeftBorder) { - new FrameItemNode(this, FrameSvg::LeftBorder, borderFitMode, filtering, oldNode); + new FrameItemNode(this, FrameSvg::LeftBorder, borderFitMode, oldNode); } if (enabledBorders() & FrameSvg::RightBorder) { - new FrameItemNode(this, FrameSvg::RightBorder, borderFitMode, filtering, oldNode); + new FrameItemNode(this, FrameSvg::RightBorder, borderFitMode, oldNode); } m_sizeChanged = true; m_textureChanged = false; } + QSGNode *node = oldNode->firstChild(); + while (node) { + static_cast(node)->setFiltering(filtering); + node = node->nextSibling(); + } + if (m_sizeChanged) { FrameNode* frameNode = static_cast(oldNode); QSize frameSize(width(), height()); @@ -590,10 +595,10 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint if (!textureNode) { delete oldNode; textureNode = new ManagedTextureNode; - textureNode->setFiltering(filtering); m_textureChanged = true; //force updating the texture on our newly created node oldNode = textureNode; } + textureNode->setFiltering(filtering); if ((m_textureChanged || m_sizeChanged) || textureNode->texture()->textureSize() != m_frameSvg->size()) { QImage image = m_frameSvg->framePixmap().toImage();