*/
class GrStencilAndCoverTextContext : public GrTextContext {
public:
- GrStencilAndCoverTextContext(GrContext*, const SkDeviceProperties&);
- virtual ~GrStencilAndCoverTextContext();
+ static GrStencilAndCoverTextContext* Create(GrContext*, const SkDeviceProperties&);
- virtual void drawText(const GrPaint&, const SkPaint&, const char text[],
- size_t byteLength,
- SkScalar x, SkScalar y) SK_OVERRIDE;
- virtual void drawPosText(const GrPaint&, const SkPaint&,
- const char text[], size_t byteLength,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPosition) SK_OVERRIDE;
-
- virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
+ virtual ~GrStencilAndCoverTextContext();
private:
static const int kGlyphBufferSize = 1024;
kMaxPerformance_RenderMode,
};
+ GrDrawState::AutoRestoreEffects fStateRestore;
+ SkScalar fTextRatio;
+ float fTextInverseRatio;
+ SkGlyphCache* fGlyphCache;
+ GrPathRange* fGlyphs;
+ uint32_t fIndexBuffer[kGlyphBufferSize];
+ float fTransformBuffer[2 * kGlyphBufferSize];
+ GrDrawTarget::PathTransformType fTransformType;
+ int fPendingGlyphCount;
+ SkMatrix fContextInitialMatrix;
+ bool fNeedsDeviceSpaceGlyphs;
+
+ GrStencilAndCoverTextContext(GrContext*, const SkDeviceProperties&);
+
+ virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
+
+ virtual void onDrawText(const GrPaint&, const SkPaint&, const char text[],
+ size_t byteLength,
+ SkScalar x, SkScalar y) SK_OVERRIDE;
+ virtual void onDrawPosText(const GrPaint&, const SkPaint&,
+ const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset) SK_OVERRIDE;
+
void init(const GrPaint&, const SkPaint&, size_t textByteLength,
- RenderMode, SkScalar textTranslateY = 0);
+ RenderMode, const SkPoint& textTranslate);
void initGlyphs(SkGlyphCache* cache);
void appendGlyph(uint16_t glyphID, float x);
void appendGlyph(uint16_t glyphID, float x, float y);
void flush();
void finish();
- GrDrawState::AutoRestoreEffects fStateRestore;
- SkScalar fTextRatio;
- float fTextInverseRatio;
- SkGlyphCache* fGlyphCache;
- GrPathRange* fGlyphs;
- uint32_t fIndexBuffer[kGlyphBufferSize];
- float fTransformBuffer[2 * kGlyphBufferSize];
- GrDrawTarget::PathTransformType fTransformType;
- int fPendingGlyphCount;
- SkMatrix fContextInitialMatrix;
- bool fNeedsDeviceSpaceGlyphs;
};
#endif