diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2011-05-10 12:11:24 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2011-05-10 12:12:44 +0200 |
commit | b909a2433e8bc4815d2f382ac23bb92ba1176b97 (patch) | |
tree | 04355c6e60215ac9bc831adce09220426cc04ff7 /src/declarative/items/qsgpainteditem.cpp | |
parent | 21deca53df68504f06d71f7b7ce4a4bfde2da0ef (diff) |
Added a separate property to enable mipmapping on QSGPaintedItem.
Don't use QSGItem's smooth property for that anymore.
Diffstat (limited to 'src/declarative/items/qsgpainteditem.cpp')
-rw-r--r-- | src/declarative/items/qsgpainteditem.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/declarative/items/qsgpainteditem.cpp b/src/declarative/items/qsgpainteditem.cpp index 89cbc5e980..6bcc60700a 100644 --- a/src/declarative/items/qsgpainteditem.cpp +++ b/src/declarative/items/qsgpainteditem.cpp @@ -103,6 +103,8 @@ QSGPaintedItemPrivate::QSGPaintedItemPrivate() , geometryDirty(false) , contentsDirty(false) , opaquePainting(false) + , antialiasing(false) + , mipmap(false) { } @@ -226,6 +228,40 @@ void QSGPaintedItem::setAntialiasing(bool enable) } /*! + Returns true if mipmaps are enabled; otherwise, false is returned. + + By default, mipmapping is not enabled. + + \sa setMipmap() +*/ +bool QSGPaintedItem::mipmap() const +{ + Q_D(const QSGPaintedItem); + return d->mipmap; +} + +/*! + If \a enable is true, mipmapping is enabled on the associated texture. + + Mipmapping increases rendering speed and reduces aliasing artifacts when the item is + scaled down. + + By default, mipmapping is not enabled. + + \sa mipmap() +*/ +void QSGPaintedItem::setMipmap(bool enable) +{ + Q_D(QSGPaintedItem); + + if (d->mipmap == enable) + return; + + d->mipmap = enable; + update(); +} + +/*! This function returns the outer bounds of the item as a rectangle; all painting must be restricted to inside an item's bounding rect. @@ -416,7 +452,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->setMipmapping(d->mipmap); node->setOpaquePainting(d->opaquePainting); node->setFillColor(d->fillColor); node->setContentsScale(d->contentsScale); |