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 GrTextStrike; | 13 class GrTextStrike; |
14 | 14 |
15 /* | 15 /* |
16 * This class implements GrTextContext using standard bitmap fonts | 16 * This class implements GrTextContext using standard bitmap fonts |
17 */ | 17 */ |
18 class GrBitmapTextContext : public GrTextContext { | 18 class GrBitmapTextContext : public GrTextContext { |
19 public: | 19 public: |
20 virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, | 20 virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkSc
alar y) SK_OVERRIDE; |
21 GrFontScaler*) SK_OVERRIDE; | 21 virtual void drawPosText(const char text[], size_t byteLength, |
| 22 const SkScalar pos[], SkScalar constY, |
| 23 int scalarsPerPosition) SK_OVERRIDE; |
22 | 24 |
23 private: | 25 private: |
24 GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&); | 26 GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDevi
ceProperties&); |
25 virtual ~GrBitmapTextContext(); | 27 virtual ~GrBitmapTextContext(); |
26 friend class GrTTextContextManager<GrBitmapTextContext>; | 28 friend class GrTTextContextManager<GrBitmapTextContext>; |
27 | 29 |
28 GrContext::AutoMatrix fAutoMatrix; | |
29 GrTextStrike* fStrike; | 30 GrTextStrike* fStrike; |
30 | 31 |
| 32 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca
ler*); |
31 void flushGlyphs(); // automatically called by destructor | 33 void flushGlyphs(); // automatically called by destructor |
32 | 34 |
33 enum { | 35 enum { |
34 kMinRequestedGlyphs = 1, | 36 kMinRequestedGlyphs = 1, |
35 kDefaultRequestedGlyphs = 64, | 37 kDefaultRequestedGlyphs = 64, |
36 kMinRequestedVerts = kMinRequestedGlyphs * 4, | 38 kMinRequestedVerts = kMinRequestedGlyphs * 4, |
37 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, | 39 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, |
38 }; | 40 }; |
39 | 41 |
40 SkPoint* fVertices; | 42 SkPoint* fVertices; |
41 int32_t fMaxVertices; | 43 int32_t fMaxVertices; |
42 GrTexture* fCurrTexture; | 44 GrTexture* fCurrTexture; |
43 int fCurrVertex; | 45 int fCurrVertex; |
44 }; | 46 }; |
45 | 47 |
46 #endif | 48 #endif |
OLD | NEW |