Added a separate property to enable mipmapping on QSGPaintedItem.
Don't use QSGItem's smooth property for that anymore.
This commit is contained in:
parent
21deca53df
commit
b909a2433e
|
@ -103,6 +103,8 @@ QSGPaintedItemPrivate::QSGPaintedItemPrivate()
|
||||||
, geometryDirty(false)
|
, geometryDirty(false)
|
||||||
, contentsDirty(false)
|
, contentsDirty(false)
|
||||||
, opaquePainting(false)
|
, opaquePainting(false)
|
||||||
|
, antialiasing(false)
|
||||||
|
, mipmap(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,6 +227,40 @@ void QSGPaintedItem::setAntialiasing(bool enable)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
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
|
This function returns the outer bounds of the item as a rectangle; all painting must be
|
||||||
restricted to inside an item's bounding rect.
|
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->setSize(QSize(qRound(br.width()), qRound(br.height())));
|
||||||
node->setSmoothPainting(d->antialiasing);
|
node->setSmoothPainting(d->antialiasing);
|
||||||
node->setLinearFiltering(d->smooth);
|
node->setLinearFiltering(d->smooth);
|
||||||
node->setMipmapping(d->smooth);
|
node->setMipmapping(d->mipmap);
|
||||||
node->setOpaquePainting(d->opaquePainting);
|
node->setOpaquePainting(d->opaquePainting);
|
||||||
node->setFillColor(d->fillColor);
|
node->setFillColor(d->fillColor);
|
||||||
node->setContentsScale(d->contentsScale);
|
node->setContentsScale(d->contentsScale);
|
||||||
|
|
|
@ -75,6 +75,9 @@ public:
|
||||||
bool antialiasing() const;
|
bool antialiasing() const;
|
||||||
void setAntialiasing(bool enable);
|
void setAntialiasing(bool enable);
|
||||||
|
|
||||||
|
bool mipmap() const;
|
||||||
|
void setMipmap(bool enable);
|
||||||
|
|
||||||
QRectF contentsBoundingRect() const;
|
QRectF contentsBoundingRect() const;
|
||||||
|
|
||||||
QSize contentsSize() const;
|
QSize contentsSize() const;
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
bool contentsDirty : 1;
|
bool contentsDirty : 1;
|
||||||
bool opaquePainting: 1;
|
bool opaquePainting: 1;
|
||||||
bool antialiasing: 1;
|
bool antialiasing: 1;
|
||||||
|
bool mipmap: 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
Loading…
Reference in New Issue