2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrBitmapTextContext_DEFINED
9 #define GrBitmapTextContext_DEFINED
11 #include "GrTextContext.h"
13 class GrGeometryProcessor;
17 * This class implements GrTextContext using standard bitmap fonts
19 class GrBitmapTextContext : public GrTextContext {
21 static GrBitmapTextContext* Create(GrContext*, const SkDeviceProperties&);
23 virtual ~GrBitmapTextContext();
26 GrTextStrike* fStrike;
29 int fAllocVertexCount;
30 int fTotalVertexCount;
32 GrTexture* fCurrTexture;
33 GrMaskFormat fCurrMaskFormat;
34 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor;
35 // Used to check whether fCachedEffect is still valid.
36 uint32_t fEffectTextureUniqueID;
38 GrBitmapTextContext(GrContext*, const SkDeviceProperties&);
40 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
42 virtual void onDrawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
43 SkScalar x, SkScalar y) SK_OVERRIDE;
44 virtual void onDrawPosText(const GrPaint&, const SkPaint&,
45 const char text[], size_t byteLength,
46 const SkScalar pos[], int scalarsPerPosition,
47 const SkPoint& offset) SK_OVERRIDE;
49 void init(const GrPaint&, const SkPaint&);
50 void appendGlyph(GrGlyph::PackedID, SkFixed left, SkFixed top, GrFontScaler*);
51 void flush(); // automatically called by destructor