aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-05-09 12:56:50 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-05-09 13:51:40 +0200
commit2aa66a66608216e8903206644efcf6a620bcd570 (patch)
tree608a775a7a93158a6a9d8d855a89ab4c5829e017 /src
parent743f8df88ae2e40506ec8e006b14f6f415c4e1be (diff)
Renamed of texture material classes to be more intuitivly named
The assumption is that most people will use QSGTextureMaterial so this should be the one that works for both transparent and opaque textures. QSGOpaqueTextureMaterial is an optimization
Diffstat (limited to 'src')
-rw-r--r--src/declarative/items/qsgninepatchnode_p.h4
-rw-r--r--src/declarative/scenegraph/qsgdefaultimagenode_p.h4
-rw-r--r--src/declarative/scenegraph/util/qsgpainternode_p.h4
-rw-r--r--src/declarative/scenegraph/util/qsgsimpletexturenode.h4
-rw-r--r--src/declarative/scenegraph/util/qsgtexturematerial.cpp54
-rw-r--r--src/declarative/scenegraph/util/qsgtexturematerial.h8
-rw-r--r--src/declarative/scenegraph/util/qsgtexturematerial_p.h2
7 files changed, 41 insertions, 39 deletions
diff --git a/src/declarative/items/qsgninepatchnode_p.h b/src/declarative/items/qsgninepatchnode_p.h
index 533495d3ce..ac927bce84 100644
--- a/src/declarative/items/qsgninepatchnode_p.h
+++ b/src/declarative/items/qsgninepatchnode_p.h
@@ -81,8 +81,8 @@ private:
void fillRow(QSGGeometry::TexturedPoint2D *&v, float y, float ty, int xChunkCount, float xChunkSize);
QRectF m_targetRect;
QRectF m_innerRect;
- QSGTextureMaterial m_material;
- QSGTextureMaterialWithOpacity m_materialO;
+ QSGOpaqueTextureMaterial m_material;
+ QSGTextureMaterial m_materialO;
QSGGeometry m_geometry;
uint m_horizontalTileMode : 2;
diff --git a/src/declarative/scenegraph/qsgdefaultimagenode_p.h b/src/declarative/scenegraph/qsgdefaultimagenode_p.h
index 8eb2c89a2a..36ae51ba4a 100644
--- a/src/declarative/scenegraph/qsgdefaultimagenode_p.h
+++ b/src/declarative/scenegraph/qsgdefaultimagenode_p.h
@@ -75,8 +75,8 @@ private:
QRectF m_targetRect;
QRectF m_sourceRect;
- QSGTextureMaterial m_material;
- QSGTextureMaterialWithOpacity m_materialO;
+ QSGOpaqueTextureMaterial m_material;
+ QSGTextureMaterial m_materialO;
uint m_dirtyGeometry : 1;
diff --git a/src/declarative/scenegraph/util/qsgpainternode_p.h b/src/declarative/scenegraph/util/qsgpainternode_p.h
index 4174eb2f16..f2fdbe5d26 100644
--- a/src/declarative/scenegraph/util/qsgpainternode_p.h
+++ b/src/declarative/scenegraph/util/qsgpainternode_p.h
@@ -118,8 +118,8 @@ private:
QGLFramebufferObject *m_multisampledFbo;
QImage m_image;
- QSGTextureMaterial m_material;
- QSGTextureMaterialWithOpacity m_materialO;
+ QSGOpaqueTextureMaterial m_material;
+ QSGTextureMaterial m_materialO;
QSGGeometry m_geometry;
QSGPainterTexture *m_texture;
diff --git a/src/declarative/scenegraph/util/qsgsimpletexturenode.h b/src/declarative/scenegraph/util/qsgsimpletexturenode.h
index b4d8b71962..44925be881 100644
--- a/src/declarative/scenegraph/util/qsgsimpletexturenode.h
+++ b/src/declarative/scenegraph/util/qsgsimpletexturenode.h
@@ -69,8 +69,8 @@ public:
private:
QSGGeometry m_geometry;
- QSGTextureMaterial m_opaque_material;
- QSGTextureMaterialWithOpacity m_material;
+ QSGOpaqueTextureMaterial m_opaque_material;
+ QSGTextureMaterial m_material;
QRectF m_rect;
};
diff --git a/src/declarative/scenegraph/util/qsgtexturematerial.cpp b/src/declarative/scenegraph/util/qsgtexturematerial.cpp
index 717bf82090..ae8edb54aa 100644
--- a/src/declarative/scenegraph/util/qsgtexturematerial.cpp
+++ b/src/declarative/scenegraph/util/qsgtexturematerial.cpp
@@ -63,34 +63,34 @@ const char qt_scenegraph_texture_material_fragment[] =
"}";
-const char *QSGTextureMaterialShader::vertexShader() const
+const char *QSGOpaqueTextureMaterialShader::vertexShader() const
{
return qt_scenegraph_texture_material_vertex_code;
}
-const char *QSGTextureMaterialShader::fragmentShader() const
+const char *QSGOpaqueTextureMaterialShader::fragmentShader() const
{
return qt_scenegraph_texture_material_fragment;
}
-QSGMaterialType QSGTextureMaterialShader::type;
+QSGMaterialType QSGOpaqueTextureMaterialShader::type;
-char const *const *QSGTextureMaterialShader::attributeNames() const
+char const *const *QSGOpaqueTextureMaterialShader::attributeNames() const
{
static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", 0 };
return attr;
}
-void QSGTextureMaterialShader::initialize()
+void QSGOpaqueTextureMaterialShader::initialize()
{
m_matrix_id = m_program.uniformLocation("qt_Matrix");
}
-void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
- QSGTextureMaterial *tx = static_cast<QSGTextureMaterial *>(newEffect);
- QSGTextureMaterial *oldTx = static_cast<QSGTextureMaterial *>(oldEffect);
+ QSGOpaqueTextureMaterial *tx = static_cast<QSGOpaqueTextureMaterial *>(newEffect);
+ QSGOpaqueTextureMaterial *oldTx = static_cast<QSGOpaqueTextureMaterial *>(oldEffect);
QSGTexture *t = tx->texture();
@@ -109,7 +109,7 @@ void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial
}
-QSGTextureMaterial::QSGTextureMaterial()
+QSGOpaqueTextureMaterial::QSGOpaqueTextureMaterial()
: m_texture(0)
, m_filtering(QSGTexture::Nearest)
, m_mipmap_filtering(QSGTexture::Nearest)
@@ -120,34 +120,34 @@ QSGTextureMaterial::QSGTextureMaterial()
-QSGMaterialType *QSGTextureMaterial::type() const
+QSGMaterialType *QSGOpaqueTextureMaterial::type() const
{
- return &QSGTextureMaterialShader::type;
+ return &QSGOpaqueTextureMaterialShader::type;
}
-QSGMaterialShader *QSGTextureMaterial::createShader() const
+QSGMaterialShader *QSGOpaqueTextureMaterial::createShader() const
{
- return new QSGTextureMaterialShader;
+ return new QSGOpaqueTextureMaterialShader;
}
-void QSGTextureMaterial::setTexture(QSGTexture *texture)
+void QSGOpaqueTextureMaterial::setTexture(QSGTexture *texture)
{
m_texture = texture;
setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false);
}
-int QSGTextureMaterial::compare(const QSGMaterial *o) const
+int QSGOpaqueTextureMaterial::compare(const QSGMaterial *o) const
{
Q_ASSERT(o && type() == o->type());
- const QSGTextureMaterial *other = static_cast<const QSGTextureMaterial *>(o);
+ const QSGOpaqueTextureMaterial *other = static_cast<const QSGOpaqueTextureMaterial *>(o);
if (int diff = m_texture->textureId() - other->texture()->textureId())
return diff;
return int(m_filtering) - int(other->m_filtering);
}
-// QSGTextureMaterialWithOpacity
+// QSGTextureMaterial
static const char qt_scenegraph_texture_material_opacity_fragment[] =
"varying highp vec2 qt_TexCoord; \n"
@@ -157,7 +157,7 @@ static const char qt_scenegraph_texture_material_opacity_fragment[] =
" gl_FragColor = texture2D(qt_Texture, qt_TexCoord) * opacity; \n"
"}";
-class TextureMaterialWithOpacityShader : public QSGTextureMaterialShader
+class QSGTextureMaterialShader : public QSGOpaqueTextureMaterialShader
{
public:
virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect);
@@ -170,30 +170,30 @@ protected:
int m_opacity_id;
};
-QSGMaterialType TextureMaterialWithOpacityShader::type;
+QSGMaterialType QSGTextureMaterialShader::type;
-QSGMaterialType *QSGTextureMaterialWithOpacity::type() const
+QSGMaterialType *QSGTextureMaterial::type() const
{
- return &TextureMaterialWithOpacityShader::type;
+ return &QSGTextureMaterialShader::type;
}
-QSGMaterialShader *QSGTextureMaterialWithOpacity::createShader() const
+QSGMaterialShader *QSGTextureMaterial::createShader() const
{
- return new TextureMaterialWithOpacityShader;
+ return new QSGTextureMaterialShader;
}
-void TextureMaterialWithOpacityShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
if (state.isOpacityDirty())
m_program.setUniformValue(m_opacity_id, state.opacity());
- QSGTextureMaterialShader::updateState(state, newEffect, oldEffect);
+ QSGOpaqueTextureMaterialShader::updateState(state, newEffect, oldEffect);
}
-void TextureMaterialWithOpacityShader::initialize()
+void QSGTextureMaterialShader::initialize()
{
- QSGTextureMaterialShader::initialize();
+ QSGOpaqueTextureMaterialShader::initialize();
m_opacity_id = m_program.uniformLocation("opacity");
}
diff --git a/src/declarative/scenegraph/util/qsgtexturematerial.h b/src/declarative/scenegraph/util/qsgtexturematerial.h
index 8a7c1a9583..375d4849cf 100644
--- a/src/declarative/scenegraph/util/qsgtexturematerial.h
+++ b/src/declarative/scenegraph/util/qsgtexturematerial.h
@@ -52,10 +52,10 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QSGTextureMaterial : public QSGMaterial
+class Q_DECLARATIVE_EXPORT QSGOpaqueTextureMaterial : public QSGMaterial
{
public:
- QSGTextureMaterial();
+ QSGOpaqueTextureMaterial();
virtual QSGMaterialType *type() const;
virtual QSGMaterialShader *createShader() const;
@@ -83,10 +83,12 @@ protected:
uint m_mipmap_filtering: 2;
uint m_horizontal_wrap : 1;
uint m_vertical_wrap: 1;
+
+ uint m_reserved : 26;
};
-class Q_DECLARATIVE_EXPORT QSGTextureMaterialWithOpacity : public QSGTextureMaterial
+class Q_DECLARATIVE_EXPORT QSGTextureMaterial : public QSGOpaqueTextureMaterial
{
public:
virtual QSGMaterialType *type() const;
diff --git a/src/declarative/scenegraph/util/qsgtexturematerial_p.h b/src/declarative/scenegraph/util/qsgtexturematerial_p.h
index 6b811c6b2e..3e14da525a 100644
--- a/src/declarative/scenegraph/util/qsgtexturematerial_p.h
+++ b/src/declarative/scenegraph/util/qsgtexturematerial_p.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QSGTextureMaterialShader : public QSGMaterialShader
+class Q_DECLARATIVE_EXPORT QSGOpaqueTextureMaterialShader : public QSGMaterialShader
{
public:
virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect);