OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrBitmapTextContext_DEFINED | 8 #ifndef GrBitmapTextContext_DEFINED |
9 #define GrBitmapTextContext_DEFINED | 9 #define GrBitmapTextContext_DEFINED |
10 | 10 |
11 #include "GrTextContext.h" | 11 #include "GrTextContext.h" |
12 | 12 |
13 class GrGeometryProcessor; | 13 class GrGeometryProcessor; |
14 class GrTextStrike; | 14 class GrTextStrike; |
15 | 15 |
16 /* | 16 /* |
17 * This class implements GrTextContext using standard bitmap fonts | 17 * This class implements GrTextContext using standard bitmap fonts |
18 */ | 18 */ |
19 class GrBitmapTextContext : public GrTextContext { | 19 class GrBitmapTextContext : public GrTextContext { |
20 public: | 20 public: |
21 static GrBitmapTextContext* Create(GrContext*, const SkDeviceProperties&); | 21 static GrBitmapTextContext* Create(GrContext*, const SkDeviceProperties&); |
22 | 22 |
23 virtual ~GrBitmapTextContext(); | 23 virtual ~GrBitmapTextContext() {} |
24 | 24 |
25 private: | 25 private: |
26 GrTextStrike* fStrike; | 26 GrTextStrike* fStrike; |
27 void* fVertices; | 27 void* fVertices; |
28 int fCurrVertex; | 28 int fCurrVertex; |
29 int fAllocVertexCount; | 29 int fAllocVertexCount; |
30 int fTotalVertexCount; | 30 int fTotalVertexCount; |
31 SkRect fVertexBounds; | 31 SkRect fVertexBounds; |
32 GrTexture* fCurrTexture; | 32 GrTexture* fCurrTexture; |
33 GrMaskFormat fCurrMaskFormat; | 33 GrMaskFormat fCurrMaskFormat; |
34 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; | 34 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; |
35 // Used to check whether fCachedEffect is still valid. | 35 // Used to check whether fCachedEffect is still valid. |
36 uint32_t fEffectTextureUniqueID; | 36 uint32_t fEffectTextureUniqueID; |
37 | 37 |
38 GrBitmapTextContext(GrContext*, const SkDeviceProperties&); | 38 GrBitmapTextContext(GrContext*, const SkDeviceProperties&); |
39 | 39 |
40 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE; | 40 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE; |
41 | 41 |
42 virtual void onDrawText(const GrPaint&, const SkPaint&, const char text[], s
ize_t byteLength, | 42 virtual void onDrawText(const GrPaint&, const SkPaint&, const char text[], s
ize_t byteLength, |
43 SkScalar x, SkScalar y) SK_OVERRIDE; | 43 SkScalar x, SkScalar y) SK_OVERRIDE; |
44 virtual void onDrawPosText(const GrPaint&, const SkPaint&, | 44 virtual void onDrawPosText(const GrPaint&, const SkPaint&, |
45 const char text[], size_t byteLength, | 45 const char text[], size_t byteLength, |
46 const SkScalar pos[], int scalarsPerPosition, | 46 const SkScalar pos[], int scalarsPerPosition, |
47 const SkPoint& offset) SK_OVERRIDE; | 47 const SkPoint& offset) SK_OVERRIDE; |
48 | 48 |
49 void init(const GrPaint&, const SkPaint&); | 49 void init(const GrPaint&, const SkPaint&); |
50 void appendGlyph(GrGlyph::PackedID, SkFixed left, SkFixed top, GrFontScaler*
); | 50 void appendGlyph(GrGlyph::PackedID, SkFixed left, SkFixed top, GrFontScaler*
); |
51 void flush(); // automatically called by destructor | 51 void flush(); // automatically called by destructor |
52 void finish(); | 52 void finish(); |
53 | |
54 }; | 53 }; |
55 | 54 |
56 #endif | 55 #endif |
OLD | NEW |