aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-10-03 13:16:10 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-03 16:18:44 +0200
commit661e624121004dd73467300e467aacae6d8d2f66 (patch)
treeec50b080d2ef38295ef7d830c1eb7d3912a3d2c4 /src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
parentc20ce89e6e92c403e9b50462a0e000056a2eff73 (diff)
Separate and fix 8/24-bit text mask materials.
The logic was a bit cluttered, trying to handle two rather different pieces of logic in one material shader. The 8-bit shader does not try to be fancy in any way, it just takes the alpha * color which gives similar intensities as the distance fields. The logic for 24-bit contains a tiny fix for opacity. The patch also includes a change from QColor -> QVector4D and QPointF -> QVector2D to simplify the conversion needed and be consistent with what kind of types we use. Task-number: QTBUG-33805 Task-number: QTBUG-33633 Task-number: QTCREATORBUG-10176 Change-Id: Ia8c464f98a1fc2c190a1d323fc21466a4d7b0dfd Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p_p.h')
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p_p.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
index bd81092806..5143921a1e 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
@@ -66,8 +66,9 @@ public:
virtual QSGMaterialShader *createShader() const;
virtual int compare(const QSGMaterial *other) const;
- void setColor(const QColor &color) { m_color = color; }
- const QColor &color() const { return m_color; }
+ void setColor(const QColor &c) { m_color = QVector4D(c.redF(), c.greenF(), c.blueF(), c.alphaF()); }
+ void setColor(const QVector4D &color) { m_color = color; }
+ const QVector4D &color() const { return m_color; }
QSGTexture *texture() const { return m_texture; }
@@ -88,7 +89,7 @@ private:
QSGPlainTexture *m_texture;
QExplicitlySharedDataPointer<QFontEngineGlyphCache> m_glyphCache;
QRawFont m_font;
- QColor m_color;
+ QVector4D m_color;
QSize m_size;
};
@@ -98,11 +99,12 @@ public:
QSGStyledTextMaterial(const QRawFont &font);
virtual ~QSGStyledTextMaterial() { }
- void setStyleShift(const QPointF &shift) { m_styleShift = shift; }
- const QPointF &styleShift() const { return m_styleShift; }
+ void setStyleShift(const QVector2D &shift) { m_styleShift = shift; }
+ const QVector2D &styleShift() const { return m_styleShift; }
- void setStyleColor(const QColor &color) { m_styleColor = color; }
- const QColor &styleColor() const { return m_styleColor; }
+ void setStyleColor(const QColor &c) { m_styleColor = QVector4D(c.redF(), c.greenF(), c.blueF(), c.alphaF()); }
+ void setStyleColor(const QVector4D &color) { m_styleColor = color; }
+ const QVector4D &styleColor() const { return m_styleColor; }
virtual QSGMaterialType *type() const;
virtual QSGMaterialShader *createShader() const;
@@ -110,8 +112,8 @@ public:
int compare(const QSGMaterial *other) const;
private:
- QPointF m_styleShift;
- QColor m_styleColor;
+ QVector2D m_styleShift;
+ QVector4D m_styleColor;
};
class QSGOutlinedTextMaterial : public QSGStyledTextMaterial