setGeometry(g);
setFlag(OwnsGeometry);
}
- static_cast<QSGVertexColorMaterial *>(material())->setOpaque(m_gradient_is_opaque);
+ static_cast<QSGVertexColorMaterial *>(material())->setColorsAreOpaque(m_gradient_is_opaque);
}
m_dirty_geometry = true;
borderIndexData.append(borderVertexCount - 2);
}
- Q_ASSERT(QSGVertexColorMaterial::is(material()));
ColorVertex *vertices = (ColorVertex *)fillVertices;
fillColor = colorToColor4ub(stops.at(nextGradientStop).second);
qreal gy = (innerRect.top() - halfPenWidth) + stops.at(nextGradientStop).first * m_rect.height();
Q_ASSERT(fillVertexCount >= 2);
- Q_ASSERT(QSGVertexColorMaterial::is(material()));
ColorVertex *vertices = (ColorVertex *)fillVertices;
fillColor = colorToColor4ub(stops.at(nextGradientStop).second);
*/
-QSGVertexColorMaterial::QSGVertexColorMaterial(bool opaque) : m_opaque(opaque)
+QSGVertexColorMaterial::QSGVertexColorMaterial()
{
- setFlag(Blending, !opaque);
+ setFlag(Blending, true);
}
/*!
- \fn bool QSGVertexColorMaterial::opaque() const
+ Sets if the renderer should treat colors as opaque.
- Returns if the vertex color material should interpret all colors
- as opaque.
+ Setting this flag can in some cases improve performance.
*/
-
-
-/*!
- Sets wether the material should interpret all colors in the
- geometry as \a opaque.
-
- This is an optimization hint. Setting opaque to true for geometry that only
- contains opaque colors, can lead to better performance.
-
- */
-
-void QSGVertexColorMaterial::setOpaque(bool opaque)
+void QSGVertexColorMaterial::setColorsAreOpaque(bool opaqueHint)
{
- setFlag(Blending, !opaque);
- m_opaque = opaque;
+ setFlag(Blending, !opaqueHint);
}
return new QSGVertexColorMaterialShader;
}
-bool QSGVertexColorMaterial::is(const QSGMaterial *effect)
-{
- return effect->type() == &QSGVertexColorMaterialShader::type;
-}
-
QT_END_NAMESPACE
class QSGVertexColorMaterial : public QSGMaterial
{
public:
- QSGVertexColorMaterial(bool opaque = false);
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
-
- void setOpaque(bool opaque);
- bool opaque() const { return m_opaque; }
+ QSGVertexColorMaterial();
- static bool is(const QSGMaterial *effect);
+ void setColorsAreOpaque(bool opaqueHint);
-private:
- bool m_opaque;
+protected:
+ virtual QSGMaterialType *type() const;
+ virtual QSGMaterialShader *createShader() const;
};
QT_END_NAMESPACE