[FrameSvgItem] Respect smooth property
This ensures the textures are rendered smoothly, especially when rotated. Differential Revision: https://phabricator.kde.org/D20570
This commit is contained in:
parent
b9ac83d4d7
commit
2a636d6671
@ -85,13 +85,14 @@ public:
|
|||||||
Tile
|
Tile
|
||||||
};
|
};
|
||||||
|
|
||||||
FrameItemNode(FrameSvgItem* frameSvg, FrameSvg::EnabledBorders borders, FitMode fitMode, QSGNode* parent)
|
FrameItemNode(FrameSvgItem* frameSvg, FrameSvg::EnabledBorders borders, FitMode fitMode, QSGTexture::Filtering filtering, QSGNode* parent)
|
||||||
: ManagedTextureNode()
|
: ManagedTextureNode()
|
||||||
, m_frameSvg(frameSvg)
|
, m_frameSvg(frameSvg)
|
||||||
, m_border(borders)
|
, m_border(borders)
|
||||||
, m_lastParent(parent)
|
, m_lastParent(parent)
|
||||||
, m_fitMode(fitMode)
|
, m_fitMode(fitMode)
|
||||||
{
|
{
|
||||||
|
setFiltering(filtering);
|
||||||
m_lastParent->appendChildNode(this);
|
m_lastParent->appendChildNode(this);
|
||||||
|
|
||||||
if (m_fitMode == Tile) {
|
if (m_fitMode == Tile) {
|
||||||
@ -523,6 +524,8 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QSGTexture::Filtering filtering = smooth() ? QSGTexture::Linear : QSGTexture::Nearest;
|
||||||
|
|
||||||
if (m_fastPath) {
|
if (m_fastPath) {
|
||||||
if (m_textureChanged) {
|
if (m_textureChanged) {
|
||||||
delete oldNode;
|
delete oldNode;
|
||||||
@ -540,30 +543,30 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
|
|||||||
FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile;
|
FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile;
|
||||||
FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile: FrameItemNode::Stretch;
|
FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile: FrameItemNode::Stretch;
|
||||||
|
|
||||||
new FrameItemNode(this, FrameSvg::NoBorder, centerFitMode, oldNode);
|
new FrameItemNode(this, FrameSvg::NoBorder, centerFitMode, filtering, oldNode);
|
||||||
if (enabledBorders() & (FrameSvg::TopBorder | FrameSvg::LeftBorder)) {
|
if (enabledBorders() & (FrameSvg::TopBorder | FrameSvg::LeftBorder)) {
|
||||||
new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, oldNode);
|
new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, filtering, oldNode);
|
||||||
}
|
}
|
||||||
if (enabledBorders() & (FrameSvg::TopBorder | FrameSvg::RightBorder)) {
|
if (enabledBorders() & (FrameSvg::TopBorder | FrameSvg::RightBorder)) {
|
||||||
new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, oldNode);
|
new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, filtering, oldNode);
|
||||||
}
|
}
|
||||||
if (enabledBorders() & FrameSvg::TopBorder) {
|
if (enabledBorders() & FrameSvg::TopBorder) {
|
||||||
new FrameItemNode(this, FrameSvg::TopBorder, borderFitMode, oldNode);
|
new FrameItemNode(this, FrameSvg::TopBorder, borderFitMode, filtering, oldNode);
|
||||||
}
|
}
|
||||||
if (enabledBorders() & FrameSvg::BottomBorder) {
|
if (enabledBorders() & FrameSvg::BottomBorder) {
|
||||||
new FrameItemNode(this, FrameSvg::BottomBorder, borderFitMode, oldNode);
|
new FrameItemNode(this, FrameSvg::BottomBorder, borderFitMode, filtering, oldNode);
|
||||||
}
|
}
|
||||||
if (enabledBorders() & (FrameSvg::BottomBorder | FrameSvg::LeftBorder)) {
|
if (enabledBorders() & (FrameSvg::BottomBorder | FrameSvg::LeftBorder)) {
|
||||||
new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, oldNode);
|
new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, filtering, oldNode);
|
||||||
}
|
}
|
||||||
if (enabledBorders() & (FrameSvg::BottomBorder | FrameSvg::RightBorder)) {
|
if (enabledBorders() & (FrameSvg::BottomBorder | FrameSvg::RightBorder)) {
|
||||||
new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, oldNode);
|
new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, filtering, oldNode);
|
||||||
}
|
}
|
||||||
if (enabledBorders() & FrameSvg::LeftBorder) {
|
if (enabledBorders() & FrameSvg::LeftBorder) {
|
||||||
new FrameItemNode(this, FrameSvg::LeftBorder, borderFitMode, oldNode);
|
new FrameItemNode(this, FrameSvg::LeftBorder, borderFitMode, filtering, oldNode);
|
||||||
}
|
}
|
||||||
if (enabledBorders() & FrameSvg::RightBorder) {
|
if (enabledBorders() & FrameSvg::RightBorder) {
|
||||||
new FrameItemNode(this, FrameSvg::RightBorder, borderFitMode, oldNode);
|
new FrameItemNode(this, FrameSvg::RightBorder, borderFitMode, filtering, oldNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sizeChanged = true;
|
m_sizeChanged = true;
|
||||||
@ -587,7 +590,7 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
|
|||||||
if (!textureNode) {
|
if (!textureNode) {
|
||||||
delete oldNode;
|
delete oldNode;
|
||||||
textureNode = new ManagedTextureNode;
|
textureNode = new ManagedTextureNode;
|
||||||
textureNode->setFiltering(QSGTexture::Nearest);
|
textureNode->setFiltering(filtering);
|
||||||
m_textureChanged = true; //force updating the texture on our newly created node
|
m_textureChanged = true; //force updating the texture on our newly created node
|
||||||
oldNode = textureNode;
|
oldNode = textureNode;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user