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 GrDistanceFieldTextContext_DEFINED | 8 #ifndef GrDistanceFieldTextContext_DEFINED |
9 #define GrDistanceFieldTextContext_DEFINED | 9 #define GrDistanceFieldTextContext_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 distance field fonts | 16 * This class implements GrTextContext using distance field fonts |
17 */ | 17 */ |
18 class GrDistanceFieldTextContext : public GrTextContext { | 18 class GrDistanceFieldTextContext : 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 | 22 const SkScalar pos[], SkScalar constY, |
23 void drawText(const char text[], size_t byteLength, | 23 int scalarsPerPosition) SK_OVERRIDE; |
24 SkScalar x, SkScalar y, SkGlyphCache*, GrFontScaler*); | |
25 void drawPosText(const char text[], size_t byteLength, | |
26 const SkScalar pos[], SkScalar constY, | |
27 int scalarsPerPosition, | |
28 SkGlyphCache* cache, GrFontScaler* fontScaler); | |
29 | |
30 const SkPaint& getSkPaint() { return fSkPaint; } | |
31 | 24 |
32 private: | 25 private: |
33 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&); | 26 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&, |
| 27 const SkDeviceProperties&); |
34 virtual ~GrDistanceFieldTextContext(); | 28 virtual ~GrDistanceFieldTextContext(); |
35 friend class GrTTextContextManager<GrDistanceFieldTextContext>; | 29 friend class GrTTextContextManager<GrDistanceFieldTextContext>; |
36 | 30 |
37 GrTextStrike* fStrike; | 31 GrTextStrike* fStrike; |
38 SkScalar fTextRatio; | 32 SkScalar fTextRatio; |
39 | 33 |
| 34 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca
ler*); |
40 void flushGlyphs(); // automatically called by destructor | 35 void flushGlyphs(); // automatically called by destructor |
41 | 36 |
42 enum { | 37 enum { |
43 kMinRequestedGlyphs = 1, | 38 kMinRequestedGlyphs = 1, |
44 kDefaultRequestedGlyphs = 64, | 39 kDefaultRequestedGlyphs = 64, |
45 kMinRequestedVerts = kMinRequestedGlyphs * 4, | 40 kMinRequestedVerts = kMinRequestedGlyphs * 4, |
46 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, | 41 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, |
47 }; | 42 }; |
48 | 43 |
49 SkPoint* fVertices; | 44 SkPoint* fVertices; |
50 int32_t fMaxVertices; | 45 int32_t fMaxVertices; |
51 GrTexture* fCurrTexture; | 46 GrTexture* fCurrTexture; |
52 int fCurrVertex; | 47 int fCurrVertex; |
53 }; | 48 }; |
54 | 49 |
55 #endif | 50 #endif |
OLD | NEW |