Support mirroring the source rectangle of ShaderEffectSource.
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>
Thu, 28 Apr 2011 13:42:46 +0000 (15:42 +0200)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>
Fri, 29 Apr 2011 14:31:44 +0000 (16:31 +0200)
src/declarative/items/qsgshadereffectsource.cpp
src/declarative/qml/qdeclarativeengine.cpp

index e63a914..e5b79a6 100644 (file)
@@ -494,12 +494,12 @@ QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNod
     QSGShaderEffectTexture *tex = qobject_cast<QSGShaderEffectTexture *>(m_texture);
 
     tex->setItem(QSGItemPrivate::get(m_sourceItem)->itemNode());
-    QRectF sourceRect = m_sourceRect.isEmpty()
+    QRectF sourceRect = m_sourceRect.isNull()
                       ? QRectF(0, 0, m_sourceItem->width(), m_sourceItem->height())
                       : m_sourceRect;
     tex->setRect(sourceRect);
     QSize textureSize = m_textureSize.isEmpty()
-                      ? QSize(qCeil(sourceRect.width()), qCeil(sourceRect.height()))
+                      ? QSize(qCeil(qAbs(sourceRect.width())), qCeil(qAbs(sourceRect.height())))
                       : m_textureSize;
     tex->setSize(textureSize);
     tex->setLive(m_live);
index b30b4cf..ba0ddbb 100644 (file)
@@ -1738,9 +1738,6 @@ 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)));
 }