Set filtering so SVG's look nice and smooth

This commit is contained in:
David Edmundson 2014-02-28 15:57:11 +01:00
parent 8bdbc034d4
commit 6968ab8117

View File

@ -151,6 +151,7 @@ QSGNode *SvgItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updateP
SVGTextureNode *textureNode = static_cast<SVGTextureNode *>(oldNode); SVGTextureNode *textureNode = static_cast<SVGTextureNode *>(oldNode);
if (!textureNode) { if (!textureNode) {
textureNode = new SVGTextureNode; textureNode = new SVGTextureNode;
textureNode->setFiltering(QSGTexture::Linear);
m_textureChanged = true; m_textureChanged = true;
} }
@ -163,6 +164,9 @@ QSGNode *SvgItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updateP
m_svg.data()->setContainsMultipleImages(!m_elementID.isEmpty()); m_svg.data()->setContainsMultipleImages(!m_elementID.isEmpty());
const QImage image = m_svg.data()->image(QSize(width(), height()), m_elementID); const QImage image = m_svg.data()->image(QSize(width(), height()), m_elementID);
QSGTexture *texture = window()->createTextureFromImage(image); QSGTexture *texture = window()->createTextureFromImage(image);
if (m_smooth) {
texture->setFiltering(QSGTexture::Linear);
}
textureNode->setTexture(texture); textureNode->setTexture(texture);
m_textureChanged = false; m_textureChanged = false;