From 155faa3b8b1e04241bd53df3eb008d54a71cc667 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 28 Apr 2011 15:42:46 +0200 Subject: [PATCH] Support mirroring the source rectangle of ShaderEffectSource. --- src/declarative/items/qsgshadereffectsource.cpp | 4 ++-- src/declarative/qml/qdeclarativeengine.cpp | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/declarative/items/qsgshadereffectsource.cpp b/src/declarative/items/qsgshadereffectsource.cpp index e63a914..e5b79a6 100644 --- a/src/declarative/items/qsgshadereffectsource.cpp +++ b/src/declarative/items/qsgshadereffectsource.cpp @@ -494,12 +494,12 @@ QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNod QSGShaderEffectTexture *tex = qobject_cast(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); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index b30b4cf..ba0ddbb 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -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))); } -- 2.7.4