diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2011-05-09 13:12:35 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2011-05-09 13:13:24 +0200 |
commit | b7e0c07633c60a901f993362df8ed356bb116a75 (patch) | |
tree | 9f977e9433cd48d31b84e2d7fdd64cc56327f06d /src | |
parent | c962253085265e2a9f1cfb42919cf44d04b2c45f (diff) |
Enable mipmapping for QSGPaintedItem's texture.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/items/qsgpainteditem.cpp | 1 | ||||
-rw-r--r-- | src/declarative/scenegraph/util/qsgpainternode.cpp | 15 | ||||
-rw-r--r-- | src/declarative/scenegraph/util/qsgpainternode_p.h | 4 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/declarative/items/qsgpainteditem.cpp b/src/declarative/items/qsgpainteditem.cpp index b93406a3d7..89cbc5e980 100644 --- a/src/declarative/items/qsgpainteditem.cpp +++ b/src/declarative/items/qsgpainteditem.cpp @@ -416,6 +416,7 @@ QSGNode *QSGPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * node->setSize(QSize(qRound(br.width()), qRound(br.height()))); node->setSmoothPainting(d->antialiasing); node->setLinearFiltering(d->smooth); + node->setMipmapping(d->smooth); node->setOpaquePainting(d->opaquePainting); node->setFillColor(d->fillColor); node->setContentsScale(d->contentsScale); diff --git a/src/declarative/scenegraph/util/qsgpainternode.cpp b/src/declarative/scenegraph/util/qsgpainternode.cpp index 1f38c6a932..ee42a3851f 100644 --- a/src/declarative/scenegraph/util/qsgpainternode.cpp +++ b/src/declarative/scenegraph/util/qsgpainternode.cpp @@ -108,6 +108,7 @@ QSGPainterNode::QSGPainterNode(QSGPaintedItem *item) , m_dirtyContents(false) , m_opaquePainting(false) , m_linear_filtering(false) + , m_mipmapping(false) , m_smoothPainting(false) , m_extensionsChecked(false) , m_multisamplingSupported(false) @@ -194,6 +195,7 @@ void QSGPainterNode::update() void QSGPainterNode::updateTexture() { + m_texture->setHasMipmaps(m_mipmapping); m_texture->setHasAlphaChannel(!m_opaquePainting); m_material.setTexture(m_texture); m_materialO.setTexture(m_texture); @@ -293,8 +295,6 @@ void QSGPainterNode::updateRenderTarget() texture->setTextureSize(m_size); m_texture = texture; - m_material.setFiltering(m_linear_filtering ? QSGTexture::Linear : QSGTexture::Nearest); - m_materialO.setFiltering(m_linear_filtering ? QSGTexture::Linear : QSGTexture::Nearest); } void QSGPainterNode::updateFBOSize() @@ -361,6 +361,17 @@ void QSGPainterNode::setLinearFiltering(bool linearFiltering) markDirty(DirtyMaterial); } +void QSGPainterNode::setMipmapping(bool mipmapping) +{ + if (mipmapping == m_mipmapping) + return; + + m_mipmapping = mipmapping; + m_material.setMipmapFiltering(mipmapping ? QSGTexture::Linear : QSGTexture::None); + m_materialO.setMipmapFiltering(mipmapping ? QSGTexture::Linear : QSGTexture::None); + m_dirtyTexture = true; +} + void QSGPainterNode::setSmoothPainting(bool s) { if (s == m_smoothPainting) diff --git a/src/declarative/scenegraph/util/qsgpainternode_p.h b/src/declarative/scenegraph/util/qsgpainternode_p.h index a5f42ca27e..4174eb2f16 100644 --- a/src/declarative/scenegraph/util/qsgpainternode_p.h +++ b/src/declarative/scenegraph/util/qsgpainternode_p.h @@ -87,6 +87,9 @@ public: void setLinearFiltering(bool linearFiltering); bool linearFiltering() const { return m_linear_filtering; } + void setMipmapping(bool mipmapping); + bool mipmapping() const { return m_mipmapping; } + void setSmoothPainting(bool s); bool smoothPainting() const { return m_smoothPainting; } @@ -126,6 +129,7 @@ private: QRect m_dirtyRect; bool m_opaquePainting; bool m_linear_filtering; + bool m_mipmapping; bool m_smoothPainting; bool m_extensionsChecked; bool m_multisamplingSupported; |