Revert "Support mirroring the source rectangle of ShaderEffectSource."
authorChris Adams <christopher.adams@nokia.com>
Wed, 18 May 2011 02:32:28 +0000 (12:32 +1000)
committerChris Adams <christopher.adams@nokia.com>
Wed, 18 May 2011 02:32:28 +0000 (12:32 +1000)
This reverts commit 155faa3b8b1e04241bd53df3eb008d54a71cc667.
The original commit broke behavior enforced by the tst_qdeclarativeqt
unit test, specifically relating to QRectF.

src/declarative/items/qsgshadereffectsource.cpp
src/declarative/qml/qdeclarativeengine.cpp

index 5b6f305..199a560 100644 (file)
@@ -774,12 +774,12 @@ QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNod
 
     tex->setLive(m_live);
     tex->setItem(QSGItemPrivate::get(m_sourceItem)->itemNode());
-    QRectF sourceRect = m_sourceRect.isNull()
+    QRectF sourceRect = m_sourceRect.isEmpty()
                       ? QRectF(0, 0, m_sourceItem->width(), m_sourceItem->height())
                       : m_sourceRect;
     tex->setRect(sourceRect);
     QSize textureSize = m_textureSize.isEmpty()
-                      ? QSize(qCeil(qAbs(sourceRect.width())), qCeil(qAbs(sourceRect.height())))
+                      ? QSize(qCeil(sourceRect.width()), qCeil(sourceRect.height()))
                       : m_textureSize;
     tex->setSize(textureSize);
     tex->setRecursive(m_recursive);
index eb2974f..0018841 100644 (file)
@@ -1740,6 +1740,9 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
     qsreal w = ctxt->argument(2).toNumber();
     qsreal h = ctxt->argument(3).toNumber();
 
+    if (w < 0 || h < 0)
+        return engine->nullValue();
+
     return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
 }