diff options
author | Yoann Lopes <yoann.lopes@digia.com> | 2013-03-12 18:43:21 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-05 15:38:04 +0200 |
commit | 57855fd6a2d3d0d3a1abbafa1000d6a1a7ce3d40 (patch) | |
tree | 75e3fccd73525341dfc5b66b4661afaeac5cdde6 /src/quick/scenegraph/qsgdefaultglyphnode_p_p.h | |
parent | fedd27e1faa65d38a1a5b11f750b5ae2fb5c4006 (diff) |
Implemented text styles for QSGDefaultGlyphNode.
Used when Text has renderType: Text.NativeRendering.
Task-number: QTBUG-27867
Change-Id: Id1262ef49e26229c86ebd2533b9f6de638bc75cb
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p_p.h')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultglyphnode_p_p.h | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h index 263523221e..d1a739de88 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h @@ -43,24 +43,25 @@ #define QSGDEFAULTGLYPHNODE_P_P_H #include <qcolor.h> +#include <QtGui/private/qopengltextureglyphcache_p.h> #include <QtQuick/qsgmaterial.h> #include <QtQuick/qsgtexture.h> #include <QtQuick/qsggeometry.h> #include <qshareddata.h> #include <QtQuick/private/qsgtexture_p.h> #include <qrawfont.h> +#include <qmargins.h> QT_BEGIN_NAMESPACE -class QFontEngineGlyphCache; -class QOpenGLTextureGlyphCache; class QFontEngine; class Geometry; class QSGTextMaskMaterial: public QSGMaterial { public: - QSGTextMaskMaterial(const QRawFont &font); - ~QSGTextMaskMaterial(); + QSGTextMaskMaterial(const QRawFont &font, + QFontEngineGlyphCache::Type cacheType = QFontEngineGlyphCache::Raster_RGBMask); + virtual ~QSGTextMaskMaterial(); virtual QSGMaterialType *type() const; virtual QSGMaterialShader *createShader() const; @@ -79,18 +80,52 @@ public: QOpenGLTextureGlyphCache *glyphCache() const; void populate(const QPointF &position, const QVector<quint32> &glyphIndexes, const QVector<QPointF> &glyphPositions, - QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine); + QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine, + const QMargins &margins = QMargins(0, 0, 0, 0)); private: void init(); QSGPlainTexture *m_texture; + QFontEngineGlyphCache::Type m_cacheType; QExplicitlySharedDataPointer<QFontEngineGlyphCache> m_glyphCache; QRawFont m_font; QColor m_color; QSize m_size; }; +class QSGStyledTextMaterial : public QSGTextMaskMaterial +{ +public: + QSGStyledTextMaterial(const QRawFont &font); + virtual ~QSGStyledTextMaterial() { } + + void setStyleShift(const QPointF &shift) { m_styleShift = shift; } + const QPointF &styleShift() const { return m_styleShift; } + + void setStyleColor(const QColor &color) { m_styleColor = color; } + const QColor &styleColor() const { return m_styleColor; } + + virtual QSGMaterialType *type() const; + virtual QSGMaterialShader *createShader() const; + + int compare(const QSGMaterial *other) const; + +private: + QPointF m_styleShift; + QColor m_styleColor; +}; + +class QSGOutlinedTextMaterial : public QSGStyledTextMaterial +{ +public: + QSGOutlinedTextMaterial(const QRawFont &font); + ~QSGOutlinedTextMaterial() { } + + QSGMaterialType *type() const; + QSGMaterialShader *createShader() const; +}; + QT_END_NAMESPACE #endif |