aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultimagenode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultimagenode.cpp')
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode.cpp57
1 files changed, 9 insertions, 48 deletions
diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp
index 69df506d2a..7f85c31ccb 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp
@@ -140,11 +140,10 @@ void SmoothTextureMaterialShader::initialize()
QSGDefaultImageNode::QSGDefaultImageNode()
: m_innerSourceRect(0, 0, 1, 1)
, m_subSourceRect(0, 0, 1, 1)
+ , m_antialiasing(false)
, m_mirror(false)
, m_dirtyGeometry(false)
, m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
- , m_antialiasing(AntialiasingNone)
-
{
setMaterial(&m_materialO);
setOpaqueMaterial(&m_material);
@@ -250,20 +249,10 @@ void QSGDefaultImageNode::setTexture(QSGTexture *texture)
void QSGDefaultImageNode::setAntialiasing(bool antialiasing)
{
- AntialiasingFlags antialiasingFlags = antialiasing
- ? AntialiasingAll
- : AntialiasingNone;
-
- setAntialiasing(antialiasingFlags);
-}
-
-void QSGDefaultImageNode::setAntialiasing(AntialiasingFlags antialiasingFlags)
-{
- if (antialiasingFlags == m_antialiasing)
+ if (antialiasing == m_antialiasing)
return;
-
- m_antialiasing = antialiasingFlags;
- if (m_antialiasing != AntialiasingNone) {
+ m_antialiasing = antialiasing;
+ if (m_antialiasing) {
setMaterial(&m_smoothMaterial);
setOpaqueMaterial(0);
setGeometry(new QSGGeometry(smoothAttributeSet(), 0));
@@ -375,14 +364,11 @@ void QSGDefaultImageNode::updateGeometry()
}
// An image can be rendered as a single quad if:
- // - There is antialiasing on all or no edges
// - There are no margins, and either:
// - the image isn't repeated
// - the source rectangle fills the entire texture so that texture wrapping can be used,
// and NPOT is supported
- if (!hasMargins
- && (m_antialiasing == AntialiasingAll || m_antialiasing == AntialiasingNone)
- && (!hasTiles || (fullTexture && wrapSupported))) {
+ if (!hasMargins && (!hasTiles || (fullTexture && wrapSupported))) {
QRectF sr;
if (!fullTexture) {
sr = QRectF(innerSourceRect.x() + (m_subSourceRect.left() - floorLeft) * innerSourceRect.width(),
@@ -561,35 +547,10 @@ void QSGDefaultImageNode::updateGeometry()
topDv = bottomDv *= 0.5f;
}
- if (!m_antialiasing.testFlag(AntialiasingTop)) {
- topDy = 0.0f;
- topDv = 0.0f;
- }
-
- if (!m_antialiasing.testFlag(AntialiasingBottom)) {
- bottomDy = 0.0f;
- bottomDv = 0.0f;
- }
-
- if (!m_antialiasing.testFlag(AntialiasingLeft)) {
- leftDx = 0.0f;
- leftDu = 0.0f;
- }
-
- if (!m_antialiasing.testFlag(AntialiasingRight)) {
- rightDx = 0.0f;
- rightDu = 0.0f;
- }
-
// This delta is how much the fuzziness can reach out from the image.
float delta = float(qAbs(m_targetRect.width()) < qAbs(m_targetRect.height())
? m_targetRect.width() : m_targetRect.height()) * 0.5f;
- float deltaTop = m_antialiasing.testFlag(AntialiasingTop) ? delta : 0.0f;
- float deltaBottom = m_antialiasing.testFlag(AntialiasingBottom) ? delta : 0.0f;
- float deltaLeft = m_antialiasing.testFlag(AntialiasingLeft) ? delta : 0.0f;
- float deltaRight = m_antialiasing.testFlag(AntialiasingRight) ? delta : 0.0f;
-
quint16 index = 0;
ys = yData.data();
for (int j = 0; j < vCells; ++j, ys += 2) {
@@ -639,28 +600,28 @@ void QSGDefaultImageNode::updateGeometry()
if (isTop) {
vertices[topLeft].dy = vertices[topRight].dy = topDy;
vertices[topLeft].dv = vertices[topRight].dv = topDv;
- vertices[topLeft + 1].dy = vertices[topRight + 1].dy = -deltaTop;
+ vertices[topLeft + 1].dy = vertices[topRight + 1].dy = -delta;
appendQuad(&indices, topLeft + 1, topRight + 1, topLeft, topRight);
}
if (isBottom) {
vertices[bottomLeft].dy = vertices[bottomRight].dy = -bottomDy;
vertices[bottomLeft].dv = vertices[bottomRight].dv = -bottomDv;
- vertices[bottomLeft + 1].dy = vertices[bottomRight + 1].dy = deltaBottom;
+ vertices[bottomLeft + 1].dy = vertices[bottomRight + 1].dy = delta;
appendQuad(&indices, bottomLeft, bottomRight, bottomLeft + 1, bottomRight + 1);
}
if (isLeft) {
vertices[topLeft].dx = vertices[bottomLeft].dx = leftDx;
vertices[topLeft].du = vertices[bottomLeft].du = leftDu;
- vertices[topLeft + 1].dx = vertices[bottomLeft + 1].dx = -deltaLeft;
+ vertices[topLeft + 1].dx = vertices[bottomLeft + 1].dx = -delta;
appendQuad(&indices, topLeft + 1, topLeft, bottomLeft + 1, bottomLeft);
}
if (isRight) {
vertices[topRight].dx = vertices[bottomRight].dx = -rightDx;
vertices[topRight].du = vertices[bottomRight].du = -rightDu;
- vertices[topRight + 1].dx = vertices[bottomRight + 1].dx = deltaRight;
+ vertices[topRight + 1].dx = vertices[bottomRight + 1].dx = delta;
appendQuad(&indices, topRight, topRight + 1, bottomRight, bottomRight + 1);
}
}