Skip to content

Commit

Permalink
Added antialiasing property to QSGPaintedItem.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoann Lopes committed May 3, 2011
1 parent d3be822 commit 9267a7b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
5 changes: 5 additions & 0 deletions examples/declarative/painteditem/main.cpp
Expand Up @@ -47,6 +47,11 @@ class MyPaintItem : public QSGPaintedItem
{
Q_OBJECT
public:
MyPaintItem() : QSGPaintedItem()
{
setAntialiasing(true);
}

virtual void paint(QPainter *p)
{
QRectF rect(0, 0, width(), height());
Expand Down
33 changes: 32 additions & 1 deletion src/declarative/items/qsgpainteditem.cpp
Expand Up @@ -186,6 +186,37 @@ void QSGPaintedItem::setOpaquePainting(bool opaque)
QSGItem::update();
}

/*!
Returns true if antialiased painting is enabled; otherwise, false is returned.
By default, antialiasing is not enabled.
\sa setAntialiasing()
*/
bool QSGPaintedItem::antialiasing() const
{
Q_D(const QSGPaintedItem);
return d->antialiasing;
}

/*!
If \a enable is true, antialiased painting is enabled.
By default, antialiasing is not enabled.
\sa antialiasing()
*/
void QSGPaintedItem::setAntialiasing(bool enable)
{
Q_D(QSGPaintedItem);

if (d->antialiasing == enable)
return;

d->antialiasing = enable;
update();
}

QSize QSGPaintedItem::contentsSize() const
{
// XXX todo
Expand Down Expand Up @@ -337,7 +368,7 @@ QSGNode *QSGPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *

node->setPreferredRenderTarget(d->renderTarget);
node->setSize(QSize(d->width, d->height));
node->setSmoothPainting(d->smooth);
node->setSmoothPainting(d->antialiasing);
node->setLinearFiltering(d->smooth);
node->setOpaquePainting(d->opaquePainting);
node->setFillColor(d->fillColor);
Expand Down
3 changes: 3 additions & 0 deletions src/declarative/items/qsgpainteditem.h
Expand Up @@ -75,6 +75,9 @@ class Q_DECLARATIVE_EXPORT QSGPaintedItem : public QSGItem
bool opaquePainting() const;
void setOpaquePainting(bool opaque);

bool antialiasing() const;
void setAntialiasing(bool enable);

QSize contentsSize() const;
void setContentsSize(const QSize &);
void resetContentsSize();
Expand Down
1 change: 1 addition & 0 deletions src/declarative/items/qsgpainteditem_p.h
Expand Up @@ -60,6 +60,7 @@ class QSGPaintedItemPrivate : public QSGItemPrivate
bool geometryDirty : 1;
bool contentsDirty : 1;
bool opaquePainting: 1;
bool antialiasing: 1;
};

QT_END_NAMESPACE
Expand Down

0 comments on commit 9267a7b

Please sign in to comment.