aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2012-06-29 17:14:10 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-13 11:25:25 +0200
commitd83eb21fb296b73bd111d907dfb9ecde373b9bb3 (patch)
treefbe6b8be85e5a52094a310a72fe5575b7e4131ee /src/quick/items
parent60a13ee3fd021080d92a11b3456602103ad61a79 (diff)
Change antialiasing method for QML2.
Since multisampling can require a lot of memory, and might not be supported on some hardware, turn off multisampling and implement antialiasing in the vertex shader instead. The alternative method of antialiasing is implemented for Rectangle, Image, BorderImage and AnimatedImage, and must be explicitly enabled by setting the new antialiasing property. Task-number: QTBUG-26268 Change-Id: I39a93d978658a494bf51e9f0fd02d8414eb8be12 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/items.pri2
-rw-r--r--src/quick/items/qquickborderimage.cpp70
-rw-r--r--src/quick/items/qquickimage.cpp11
-rw-r--r--src/quick/items/qquickitem.cpp113
-rw-r--r--src/quick/items/qquickitem.h5
-rw-r--r--src/quick/items/qquickitem_p.h4
-rw-r--r--src/quick/items/qquickninepatchnode.cpp305
-rw-r--r--src/quick/items/qquickninepatchnode_p.h98
-rw-r--r--src/quick/items/qquickrectangle.cpp1
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp2
10 files changed, 160 insertions, 451 deletions
diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri
index 4f22b32837..9f205ed503 100644
--- a/src/quick/items/items.pri
+++ b/src/quick/items/items.pri
@@ -30,7 +30,6 @@ HEADERS += \
$$PWD/qquickimage_p_p.h \
$$PWD/qquickborderimage_p.h \
$$PWD/qquickborderimage_p_p.h \
- $$PWD/qquickninepatchnode_p.h \
$$PWD/qquickscalegrid_p_p.h \
$$PWD/qquickmousearea_p.h \
$$PWD/qquickmousearea_p_p.h \
@@ -96,7 +95,6 @@ SOURCES += \
$$PWD/qquickimagebase.cpp \
$$PWD/qquickimage.cpp \
$$PWD/qquickborderimage.cpp \
- $$PWD/qquickninepatchnode.cpp \
$$PWD/qquickscalegrid.cpp \
$$PWD/qquickmousearea.cpp \
$$PWD/qquickpincharea.cpp \
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index abd20c66f0..889877aea1 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -41,7 +41,6 @@
#include "qquickborderimage_p.h"
#include "qquickborderimage_p_p.h"
-#include "qquickninepatchnode_p.h"
#include <QtQml/qqmlinfo.h>
#include <QtQml/qqmlfile.h>
@@ -565,29 +564,70 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
return 0;
}
- QQuickNinePatchNode *node = static_cast<QQuickNinePatchNode *>(oldNode);
+ QSGImageNode *node = static_cast<QSGImageNode *>(oldNode);
- if (!node) {
- node = new QQuickNinePatchNode();
- }
+ if (!node)
+ node = d->sceneGraphContext()->createImageNode();
node->setTexture(texture);
// Don't implicitly create the scalegrid in the rendering thread...
+ QRectF innerSourceRect(0, 0, 1, 1);
+ QRectF targetRect(0, 0, width(), height());
+ QRectF innerTargetRect = targetRect;
if (d->border) {
const QQuickScaleGrid *border = d->getScaleGrid();
- node->setInnerRect(QRectF(border->left(),
- border->top(),
- qMax(1, d->pix.width() - border->right() - border->left()),
- qMax(1, d->pix.height() - border->bottom() - border->top())));
- } else {
- node->setInnerRect(QRectF(0, 0, d->pix.width(), d->pix.height()));
+ innerSourceRect = QRectF(border->left() / qreal(d->pix.width()),
+ border->top() / qreal(d->pix.height()),
+ qMax<qreal>(0, d->pix.width() - border->right() - border->left()) / d->pix.width(),
+ qMax<qreal>(0, d->pix.height() - border->bottom() - border->top()) / d->pix.height());
+ innerTargetRect = QRectF(border->left(),
+ border->top(),
+ qMax<qreal>(0, width() - border->right() - border->left()),
+ qMax<qreal>(0, height() - border->bottom() - border->top()));
}
- node->setRect(QRectF(0, 0, width(), height()));
- node->setFiltering(d->smooth ? QSGTexture::Linear : QSGTexture::Nearest);
- node->setHorzontalTileMode(d->horizontalTileMode);
- node->setVerticalTileMode(d->verticalTileMode);
+ qreal hTiles = 1;
+ qreal vTiles = 1;
+ if (innerSourceRect.width() != 0) {
+ switch (d->horizontalTileMode) {
+ case QQuickBorderImage::Repeat:
+ hTiles = innerTargetRect.width() / qreal(innerSourceRect.width() * d->pix.width());
+ break;
+ case QQuickBorderImage::Round:
+ hTiles = qCeil(innerTargetRect.width() / qreal(innerSourceRect.width() * d->pix.width()));
+ break;
+ default:
+ break;
+ }
+ }
+ if (innerSourceRect.height() != 0) {
+ switch (d->verticalTileMode) {
+ case QQuickBorderImage::Repeat:
+ vTiles = innerTargetRect.height() / qreal(innerSourceRect.height() * d->pix.height());
+ break;
+ case QQuickBorderImage::Round:
+ vTiles = qCeil(innerTargetRect.height() / qreal(innerSourceRect.height() * d->pix.height()));
+ break;
+ default:
+ break;
+ }
+ }
+
+ node->setTargetRect(targetRect);
+ node->setInnerSourceRect(innerSourceRect);
+ node->setInnerTargetRect(innerTargetRect);
+ node->setSubSourceRect(QRectF(0, 0, hTiles, vTiles));
node->setMirror(d->mirror);
+
+ node->setFiltering(d->smooth ? QSGTexture::Linear : QSGTexture::Nearest);
+ if (innerSourceRect == QRectF(0, 0, 1, 1) && (vTiles > 1 || hTiles > 1)) {
+ node->setHorizontalWrapMode(QSGTexture::Repeat);
+ node->setVerticalWrapMode(QSGTexture::Repeat);
+ } else {
+ node->setHorizontalWrapMode(QSGTexture::ClampToEdge);
+ node->setVerticalWrapMode(QSGTexture::ClampToEdge);
+ }
+ node->setAntialiasing(d->antialiasing);
node->update();
return node;
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index aa68477a9d..f4089be48c 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -674,18 +674,15 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
sourceRect.width() / d->pix.width(),
sourceRect.height() / d->pix.height());
- if (d->mirror) {
- qreal oldLeft = nsrect.left();
- nsrect.setLeft(nsrect.right());
- nsrect.setRight(oldLeft);
- }
-
node->setHorizontalWrapMode(hWrap);
node->setVerticalWrapMode(vWrap);
node->setFiltering(d->smooth ? QSGTexture::Linear : QSGTexture::Nearest);
node->setTargetRect(targetRect);
- node->setSourceRect(nsrect);
+ node->setInnerTargetRect(targetRect);
+ node->setSubSourceRect(nsrect);
+ node->setMirror(d->mirror);
+ node->setAntialiasing(d->antialiasing);
node->update();
return node;
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index d3c8973653..a41e451209 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2401,26 +2401,53 @@ bool QQuickItem::isComponentComplete() const
}
QQuickItemPrivate::QQuickItemPrivate()
-: _anchors(0), _stateGroup(0),
- flags(0), widthValid(false), heightValid(false), baselineOffsetValid(false), componentComplete(true),
- keepMouse(false), keepTouch(false), hoverEnabled(false), smooth(true), focus(false), activeFocus(false), notifiedFocus(false),
- notifiedActiveFocus(false), filtersChildMouseEvents(false), explicitVisible(true),
- effectiveVisible(true), explicitEnable(true), effectiveEnable(true), polishScheduled(false),
- inheritedLayoutMirror(false), effectiveLayoutMirror(false), isMirrorImplicit(true),
- inheritMirrorFromParent(false), inheritMirrorFromItem(false),
- isAccessible(false), culled(false),
-
- dirtyAttributes(0), nextDirtyItem(0), prevDirtyItem(0),
-
- canvas(0), canvasRefCount(0), parentItem(0), sortedChildItems(&childItems),
-
- subFocusItem(0),
-
- x(0), y(0), width(0), height(0), implicitWidth(0), implicitHeight(0),
-
- baselineOffset(0),
-
- itemNodeInstance(0), groupNode(0), paintNode(0)
+ : _anchors(0)
+ , _stateGroup(0)
+ , flags(0)
+ , widthValid(false)
+ , heightValid(false)
+ , baselineOffsetValid(false)
+ , componentComplete(true)
+ , keepMouse(false)
+ , keepTouch(false)
+ , hoverEnabled(false)
+ , smooth(true)
+ , antialiasing(false)
+ , focus(false)
+ , activeFocus(false)
+ , notifiedFocus(false)
+ , notifiedActiveFocus(false)
+ , filtersChildMouseEvents(false)
+ , explicitVisible(true)
+ , effectiveVisible(true)
+ , explicitEnable(true)
+ , effectiveEnable(true)
+ , polishScheduled(false)
+ , inheritedLayoutMirror(false)
+ , effectiveLayoutMirror(false)
+ , isMirrorImplicit(true)
+ , inheritMirrorFromParent(false)
+ , inheritMirrorFromItem(false)
+ , isAccessible(false)
+ , culled(false)
+ , dirtyAttributes(0)
+ , nextDirtyItem(0)
+ , prevDirtyItem(0)
+ , canvas(0)
+ , canvasRefCount(0)
+ , parentItem(0)
+ , sortedChildItems(&childItems)
+ , subFocusItem(0)
+ , x(0)
+ , y(0)
+ , width(0)
+ , height(0)
+ , implicitWidth(0)
+ , implicitHeight(0)
+ , baselineOffset(0)
+ , itemNodeInstance(0)
+ , groupNode(0)
+ , paintNode(0)
{
}
@@ -4321,6 +4348,7 @@ QString QQuickItemPrivate::dirtyToString() const
DIRTY_TO_STRING(EffectReference);
DIRTY_TO_STRING(Visible);
DIRTY_TO_STRING(HideReference);
+ DIRTY_TO_STRING(Antialiasing);
return rv;
}
@@ -4488,10 +4516,10 @@ void QQuickItemPrivate::itemChange(QQuickItem::ItemChange change, const QQuickIt
*/
/*!
- Returns true if the item should be drawn with antialiasing and
+ Returns true if the item should be drawn with
smooth pixmap filtering, false otherwise.
- The default is false.
+ The default is true.
\sa setSmooth()
*/
@@ -4519,6 +4547,47 @@ void QQuickItem::setSmooth(bool smooth)
emit smoothChanged(smooth);
}
+/*!
+ \property QQuickItem::antialiasing
+ \brief Specifies whether the item is antialiased or not
+
+ Primarily used in Rectangle and image based elements to decide if the item should
+ use antialiasing or not. Items with antialiasing enabled require more memory and
+ are potentially slower to render.
+
+ The default is false.
+*/
+
+/*!
+ Returns true if the item should be drawn with antialiasing, false otherwise.
+
+ The default is false.
+
+ \sa setAntialiasing()
+*/
+bool QQuickItem::antialiasing() const
+{
+ Q_D(const QQuickItem);
+ return d->antialiasing;
+}
+
+/*!
+ Sets whether the item should be drawn with antialiasing to \a antialiasing.
+
+ \sa antialiasing()
+*/
+void QQuickItem::setAntialiasing(bool antialiasing)
+{
+ Q_D(QQuickItem);
+ if (d->antialiasing == antialiasing)
+ return;
+
+ d->antialiasing = antialiasing;
+ d->dirty(QQuickItemPrivate::Antialiasing);
+
+ emit antialiasingChanged(antialiasing);
+}
+
QQuickItem::Flags QQuickItem::flags() const
{
Q_D(const QQuickItem);
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index 7174edd057..15bf5dd46d 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -142,6 +142,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus
Q_PROPERTY(QQmlListProperty<QQuickTransform> transform READ transform DESIGNABLE false FINAL)
Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
+ Q_PROPERTY(bool antialiasing READ antialiasing WRITE setAntialiasing NOTIFY antialiasingChanged)
Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged)
Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged)
@@ -258,6 +259,9 @@ public:
bool smooth() const;
void setSmooth(bool);
+ bool antialiasing() const;
+ void setAntialiasing(bool);
+
Flags flags() const;
void setFlag(Flag flag, bool enabled = true);
void setFlags(Flags flags);
@@ -332,6 +336,7 @@ Q_SIGNALS:
void parentChanged(QQuickItem *);
void transformOriginChanged(TransformOrigin);
void smoothChanged(bool);
+ void antialiasingChanged(bool);
void clipChanged(bool);
// XXX todo
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index ddebefdb40..69099212ea 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -389,6 +389,7 @@ public:
bool keepTouch:1;
bool hoverEnabled:1;
bool smooth:1;
+ bool antialiasing:1;
bool focus:1;
bool activeFocus:1;
bool notifiedFocus:1;
@@ -431,13 +432,14 @@ public:
EffectReference = 0x00008000,
Visible = 0x00010000,
HideReference = 0x00020000,
+ Antialiasing = 0x00040000,
// When you add an attribute here, don't forget to update
// dirtyToString()
TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position |
Size | Canvas,
ComplexTransformUpdateMask = Transform | Canvas,
- ContentUpdateMask = Size | Content | Smooth | Canvas,
+ ContentUpdateMask = Size | Content | Smooth | Canvas | Antialiasing,
ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Canvas
};
diff --git a/src/quick/items/qquickninepatchnode.cpp b/src/quick/items/qquickninepatchnode.cpp
deleted file mode 100644
index d304e2dece..0000000000
--- a/src/quick/items/qquickninepatchnode.cpp
+++ /dev/null
@@ -1,305 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickninepatchnode_p.h"
-#include <private/qsgadaptationlayer_p.h>
-#include <private/qmath_p.h>
-
-QQuickNinePatchNode::QQuickNinePatchNode()
- : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0)
- , m_horizontalTileMode(QQuickBorderImage::Stretch)
- , m_verticalTileMode(QQuickBorderImage::Stretch)
- , m_dirtyGeometry(false)
- , m_mirror(false)
-{
- m_geometry.setIndexDataPattern(QSGGeometry::StaticPattern);
- m_geometry.setVertexDataPattern(QSGGeometry::StaticPattern);
-
- setOpaqueMaterial(&m_material);
- setMaterial(&m_materialO);
- setGeometry(&m_geometry);
- m_geometry.setDrawingMode(GL_TRIANGLES);
-#ifdef QML_RUNTIME_TESTING
- description = QLatin1String("borderimage");
-#endif
-}
-
-void QQuickNinePatchNode::setInnerRect(const QRectF &rect)
-{
- if (m_innerRect == rect)
- return;
- m_innerRect = rect;
- m_dirtyGeometry = true;
-}
-
-void QQuickNinePatchNode::setRect(const QRectF &rect)
-{
- if (m_targetRect == rect)
- return;
- m_targetRect = rect;
- m_dirtyGeometry = true;
-}
-
-void QQuickNinePatchNode::setHorzontalTileMode(QQuickBorderImage::TileMode mode)
-{
- if (mode == QQuickBorderImage::TileMode(m_horizontalTileMode))
- return;
- m_horizontalTileMode = mode;
- m_dirtyGeometry = true;
-}
-
-
-void QQuickNinePatchNode::setVerticalTileMode(QQuickBorderImage::TileMode mode)
-{
- if (mode == QQuickBorderImage::TileMode(m_verticalTileMode))
- return;
- m_verticalTileMode = mode;
- m_dirtyGeometry = true;
-}
-
-
-void QQuickNinePatchNode::setFiltering(QSGTexture::Filtering filtering)
-{
- if (m_material.filtering() == filtering)
- return;
-
- m_material.setFiltering(filtering);
- m_materialO.setFiltering(filtering);
- markDirty(DirtyMaterial);
-}
-
-QSGTexture::Filtering QQuickNinePatchNode::filtering() const
-{
- return m_material.filtering();
-}
-
-void QQuickNinePatchNode::setTexture(QSGTexture *texture)
-{
- if (texture == m_material.texture())
- return;
- m_material.setTexture(texture);
- m_materialO.setTexture(texture);
- markDirty(DirtyMaterial);
-}
-
-QSGTexture *QQuickNinePatchNode::texture() const
-{
- return m_material.texture();
-}
-
-void QQuickNinePatchNode::setMirror(bool m)
-{
- if (m_mirror == m)
- return;
- m_mirror = m;
- m_dirtyGeometry = true;
-}
-
-
-void QQuickNinePatchNode::update()
-{
- if (!m_dirtyGeometry)
- return;
-
- // For stretch this algorithm could be simplified to use less vertices
- // as more vertices could be reused then, but I doubt its where our main
- // problem will lie. This way, we at least share the algorithm between all
-
- Q_ASSERT(m_material.texture());
-
- float tw = m_material.texture()->textureSize().width();
- float th = m_material.texture()->textureSize().height();
-
- QRectF textureSubRect = m_material.texture()->normalizedTextureSubRect();
- QSize textureSize = m_material.texture()->textureSize();
-
- float rightBorder = tw - m_innerRect.right();
- float bottomBorder = th - m_innerRect.bottom();
-
-// qDebug() << m_innerRect << m_targetRect << m_horizontalTileMode << m_verticalTileMode;
-
- int xChunkCount = 0; // Number of chunks
- float xChunkSize = 0; // Size of chunk in pixels
- float xTexSize = m_innerRect.width(); // Size of the texture to stretch/tile
- float xSize = m_targetRect.width() - m_innerRect.left() - rightBorder; // Size of area to fill with chunks
-
- if (m_horizontalTileMode == QQuickBorderImage::Repeat) {
- xChunkCount = qCeil(xSize / xTexSize);
- xChunkSize = xTexSize;
- } else if (m_horizontalTileMode == QQuickBorderImage::Round) {
- xChunkCount = qCeil(xSize / xTexSize);
- qreal fullWidth = xChunkCount * xTexSize;
- xChunkSize = xTexSize * xSize / fullWidth;
- } else {
- xChunkCount = 1;
- xChunkSize = xSize;
- }
-
- int yChunkCount = 0;
- float yChunkSize = 0; // Relative to target rect.
- float yTexSize = m_innerRect.height(); // Size of the texture to stretch/tile
- float ySize = m_targetRect.height() - m_innerRect.top() - bottomBorder;
-
- if (m_verticalTileMode == QQuickBorderImage::Repeat) {
- yChunkCount = qCeil(ySize / yTexSize);
- yChunkSize = yTexSize;
- } else if (m_verticalTileMode == QQuickBorderImage::Round) {
- yChunkCount = qCeil(ySize / yTexSize);
- qreal fullHeight = yChunkCount * yTexSize;
- yChunkSize = yTexSize * ySize / fullHeight;
- } else {
- yChunkCount = 1;
- yChunkSize = ySize;
- }
-
- int xTotalChunkCount = xChunkCount + 2;
- int yTotalChunkCount = yChunkCount + 2;
-
- int totalChunkCount = xTotalChunkCount * yTotalChunkCount;
- int vertexCount = totalChunkCount * 4;
- int indexCount = totalChunkCount * 6;
-
- if (vertexCount != m_geometry.vertexCount() || indexCount != m_geometry.indexCount())
- m_geometry.allocate(vertexCount, indexCount);
-
- QSGGeometry::TexturedPoint2D *v = m_geometry.vertexDataAsTexturedPoint2D();
-
-
- // Fill in the vertices.. The loop below is pretty much an exact replica
- // of the one inside fillRow.
- float yTexChunk1 = m_innerRect.top() / th;
- float yTexChunk2 = m_innerRect.bottom() / th;
-
- fillRow(v, 0, 0, xChunkCount, xChunkSize, textureSubRect, textureSize);
- fillRow(v, m_innerRect.y(), yTexChunk1, xChunkCount, xChunkSize, textureSubRect, textureSize);
-
- for (int yc=0; yc<yChunkCount; ++yc) {
- float yy = m_innerRect.y() + yChunkSize * yc;
- fillRow(v, yy, yTexChunk1, xChunkCount, xChunkSize, textureSubRect, textureSize);
-
- // Special case the last one
- if (yc == yChunkCount - 1) {
- float t = m_verticalTileMode == QQuickBorderImage::Repeat
- ? yTexChunk1 + (yTexChunk2 - yTexChunk1) * (m_targetRect.height() - bottomBorder - yy) / yChunkSize
- : yTexChunk2;
- fillRow(v, m_targetRect.height() - bottomBorder, t, xChunkCount, xChunkSize, textureSubRect, textureSize);
- } else {
- fillRow(v, yy + yChunkSize, yTexChunk2, xChunkCount, xChunkSize, textureSubRect, textureSize);
- }
- }
-
- fillRow(v, m_targetRect.height() - bottomBorder, yTexChunk2, xChunkCount, xChunkSize, textureSubRect, textureSize);
- fillRow(v, m_targetRect.height(), 1, xChunkCount, xChunkSize, textureSubRect, textureSize);
-
- if (m_mirror) {
- v = m_geometry.vertexDataAsTexturedPoint2D();
- for (int i=0; i<m_geometry.vertexCount(); ++i) {
- v->x = m_targetRect.width() - v->x;
- ++v;
- }
- }
-
-// v = m_geometry.vertexDataAsTexturedPoint2D();
-// for (int i=0; i<m_geometry.vertexCount(); ++i) {
-// printf("Vertex: %d: (%.3f, %.3f) - (%.3f, %.3f)\n",
-// i,
-// v->x, v->y, v->tx, v->ty);
-// ++v;
-// }
-
- quint16 *i = m_geometry.indexDataAsUShort();
- int row = xTotalChunkCount * 2;
- for (int r=0; r<yTotalChunkCount; ++r) {
- int offset = r * row * 2;
- for (int c=0; c<xTotalChunkCount; ++c) {
- *i++ = offset + c * 2;
- *i++ = offset + c * 2 + 1;
- *i++ = offset + c * 2 + row;
- *i++ = offset + c * 2 + 1;
- *i++ = offset + c * 2 + row + 1;
- *i++ = offset + c * 2 + row;
- }
- }
-
-// i = m_geometry.indexDataAsUShort();
-// for (int idx=0; idx<m_geometry.indexCount(); idx+=6) {
-// printf("%2d: ", idx / 6);
-// for (int s=0; s<6; ++s)
-// printf(" %d", i[idx + s]);
-// printf("\n");
-// }
-
- markDirty(QSGNode::DirtyGeometry);
-}
-
-void QQuickNinePatchNode::fillRow(QSGGeometry::TexturedPoint2D *&v, float y, float ty, int xChunkCount, float xChunkSize,
- const QRectF &tsr, // texture sub rect, for atlasses
- const QSize &ts) // texture size in pixels
-{
- ty = tsr.y() + ty * tsr.height();
-
- float tw = ts.width();
- float rightBorder = tw - m_innerRect.right();
- float xTexChunk1 = tsr.left() + tsr.width() * m_innerRect.left() / tw;
- float xTexChunk2 = tsr.left() + tsr.width() * m_innerRect.right() / tw;
-
- v++->set(0, y, tsr.left(), ty);
- v++->set(m_innerRect.x(), y, xTexChunk1, ty);
-
- for (int xc=0; xc<xChunkCount; ++xc) {
- float xx = m_innerRect.x() + xChunkSize * xc;
- v++->set(xx, y, xTexChunk1, ty);
-
- // Special case the last one
- if (xc == xChunkCount - 1) {
- float t = m_horizontalTileMode == QQuickBorderImage::Repeat
- ? xTexChunk1 + (xTexChunk2 - xTexChunk1) * (m_targetRect.width() - rightBorder - xx) / xChunkSize
- : xTexChunk2;
- v->set(m_targetRect.width() - rightBorder, y, t, ty);
- } else {
- v->set(xx + xChunkSize, y, xTexChunk2, ty);
- }
- ++v;
- }
-
- v++->set(m_targetRect.width() - rightBorder, y, xTexChunk2, ty);
- v++->set(m_targetRect.width(), y, tsr.right(), ty);
-}
diff --git a/src/quick/items/qquickninepatchnode_p.h b/src/quick/items/qquickninepatchnode_p.h
deleted file mode 100644
index c2761f74e5..0000000000
--- a/src/quick/items/qquickninepatchnode_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKNINEPATCHNODE_H
-#define QQUICKNINEPATCHNODE_H
-
-#include <QtQuick/qsgnode.h>
-#include <QtQuick/qsgtexturematerial.h>
-#include "qquickborderimage_p.h"
-
-class TextureReference;
-
-class QQuickNinePatchNode : public QSGGeometryNode
-{
-public:
- QQuickNinePatchNode();
-
- void setTexture(QSGTexture *texture);
- QSGTexture *texture() const;
-
- void setRect(const QRectF &rect);
- QRectF rect() const { return m_targetRect; }
-
- void setInnerRect(const QRectF &rect);
- QRectF innerRect() const { return m_innerRect; }
-
- void setFiltering(QSGTexture::Filtering filtering);
- QSGTexture::Filtering filtering() const;
-
- void setHorzontalTileMode(QQuickBorderImage::TileMode mode);
- QQuickBorderImage::TileMode horizontalTileMode() const {
- return (QQuickBorderImage::TileMode) m_horizontalTileMode;
- }
-
- void setVerticalTileMode(QQuickBorderImage::TileMode mode);
- QQuickBorderImage::TileMode verticalTileMode() const {
- return (QQuickBorderImage::TileMode) m_verticalTileMode;
- }
-
- void setMirror(bool m);
- bool mirror() const { return m_mirror; }
-
- void update();
-
-private:
- void fillRow(QSGGeometry::TexturedPoint2D *&v, float y, float ty, int xChunkCount, float xChunkSize, const QRectF &tsr, const QSize &ts);
- QRectF m_targetRect;
- QRectF m_innerRect;
- QSGOpaqueTextureMaterial m_material;
- QSGTextureMaterial m_materialO;
- QSGGeometry m_geometry;
-
- uint m_horizontalTileMode : 2;
- uint m_verticalTileMode : 2;
-
- uint m_dirtyGeometry : 1;
- uint m_mirror : 1;
-};
-
-#endif // QQUICKNINEPATCHNODE_H
diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp
index 608fd94ac1..ec300e87b0 100644
--- a/src/quick/items/qquickrectangle.cpp
+++ b/src/quick/items/qquickrectangle.cpp
@@ -502,6 +502,7 @@ QSGNode *QQuickRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
}
rectangle->setRadius(d->radius);
+ rectangle->setAntialiasing(d->antialiasing);
QGradientStops stops;
if (d->gradient) {
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index 3f36c86d0c..20b919018e 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -1006,7 +1006,7 @@ QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaint
node->setHorizontalWrapMode(hWrap);
node->setVerticalWrapMode(vWrap);
node->setTargetRect(QRectF(0, 0, width(), height()));
- node->setSourceRect(QRectF(0, 0, 1, 1));
+ node->setInnerTargetRect(QRectF(0, 0, width(), height()));
node->update();
return node;