Commit 814deac3 authored by Kim Motoyoshi Kalland's avatar Kim Motoyoshi Kalland Committed by Qt by Nokia

Let Item.layer.samplerName be a QByteArray instead of QString.

Both Qt's property system and OpenGL shaders use 8-bit characters,
so there is no need to use a QString for samplerName.

Change-Id: I8cc29c74adb5d71a34cc99d9ecebbbba8b554cdf
Reviewed-by: default avatarGunnar Sletta <>
parent 5cc1870d
......@@ -5384,11 +5384,11 @@ QQuickItemLayer::QQuickItemLayer(QQuickItem *item)
, m_componentComplete(true)
, m_wrapMode(QQuickShaderEffectSource::ClampToEdge)
, m_format(QQuickShaderEffectSource::RGBA)
, m_name("source")
, m_effectComponent(0)
, m_effect(0)
, m_effectSource(0)
m_name = QLatin1String("source");
......@@ -5509,7 +5509,7 @@ void QQuickItemLayer::activateEffect()
m_effect->setProperty(m_name.toLatin1(), qVariantFromValue<QObject *>(m_effectSource));
m_effect->setProperty(m_name, qVariantFromValue<QObject *>(m_effectSource));
void QQuickItemLayer::deactivateEffect()
......@@ -5724,12 +5724,12 @@ void QQuickItemLayer::setWrapMode(QQuickShaderEffectSource::WrapMode mode)
\sa effect, ShaderEffect
void QQuickItemLayer::setName(const QString &name) {
void QQuickItemLayer::setName(const QByteArray &name) {
if (m_name == name)
if (m_effect) {
m_effect->setProperty(m_name.toLatin1(), QVariant());
m_effect->setProperty(name.toLatin1(), qVariantFromValue<QObject *>(m_effectSource));
m_effect->setProperty(m_name, QVariant());
m_effect->setProperty(name, qVariantFromValue<QObject *>(m_effectSource));
m_name = name;
emit nameChanged(name);
......@@ -148,7 +148,7 @@ class QQuickItemLayer : public QObject, public QQuickItemChangeListener
Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
Q_PROPERTY(QQuickShaderEffectSource::WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
Q_PROPERTY(QQuickShaderEffectSource::Format format READ format WRITE setFormat NOTIFY formatChanged)
Q_PROPERTY(QString samplerName READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QByteArray samplerName READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QDeclarativeComponent *effect READ effect WRITE setEffect NOTIFY effectChanged)
QQuickItemLayer(QQuickItem *item);
......@@ -178,8 +178,8 @@ public:
QQuickShaderEffectSource::WrapMode wrapMode() const { return m_wrapMode; }
void setWrapMode(QQuickShaderEffectSource::WrapMode mode);
QString name() const { return m_name; }
void setName(const QString &name);
QByteArray name() const { return m_name; }
void setName(const QByteArray &name);
QDeclarativeComponent *effect() const { return m_effectComponent; }
void setEffect(QDeclarativeComponent *effect);
......@@ -202,7 +202,7 @@ signals:
void sizeChanged(const QSize &size);
void mipmapChanged(bool mipmap);
void wrapModeChanged(QQuickShaderEffectSource::WrapMode mode);
void nameChanged(const QString &name);
void nameChanged(const QByteArray &name);
void effectChanged(QDeclarativeComponent *component);
void smoothChanged(bool smooth);
void formatChanged(QQuickShaderEffectSource::Format format);
......@@ -223,7 +223,7 @@ private:
QQuickShaderEffectSource::Format m_format;
QSize m_size;
QRectF m_sourceRect;
QString m_name;
QByteArray m_name;
QDeclarativeComponent *m_effectComponent;
QQuickItem *m_effect;
QQuickShaderEffectSource *m_effectSource;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment