OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrTextContext_DEFINED | 8 #ifndef GrTextContext_DEFINED |
9 #define GrTextContext_DEFINED | 9 #define GrTextContext_DEFINED |
10 | 10 |
11 #include "GrContext.h" | 11 #include "GrContext.h" |
12 #include "GrGlyph.h" | 12 #include "GrGlyph.h" |
13 #include "GrPaint.h" | 13 #include "GrPaint.h" |
14 | 14 |
15 class GrContext; | 15 class GrContext; |
16 class GrTextStrike; | 16 class GrDrawTarget; |
17 class GrFontScaler; | 17 class GrFontScaler; |
18 class GrDrawTarget; | |
19 | 18 |
| 19 /* |
| 20 * This class wraps the state for a single text render |
| 21 */ |
20 class GrTextContext { | 22 class GrTextContext { |
21 public: | 23 public: |
| 24 virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, |
| 25 GrFontScaler*) = 0; |
| 26 |
| 27 protected: |
22 GrTextContext(GrContext*, const GrPaint&); | 28 GrTextContext(GrContext*, const GrPaint&); |
23 ~GrTextContext(); | 29 virtual ~GrTextContext() {} |
24 | 30 |
25 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, | 31 GrPaint fPaint; |
26 GrFontScaler*); | 32 GrContext* fContext; |
| 33 GrDrawTarget* fDrawTarget; |
27 | 34 |
28 void flush(); // optional; automatically called by destructor | 35 SkIRect fClipRect; |
29 | 36 |
30 private: | 37 private: |
31 GrPaint fPaint; | |
32 GrContext* fContext; | |
33 GrDrawTarget* fDrawTarget; | |
34 | |
35 GrFontScaler* fScaler; | |
36 GrTextStrike* fStrike; | |
37 | |
38 inline void flushGlyphs(); | |
39 void setupDrawTarget(); | |
40 | |
41 enum { | |
42 kMinRequestedGlyphs = 1, | |
43 kDefaultRequestedGlyphs = 64, | |
44 kMinRequestedVerts = kMinRequestedGlyphs * 4, | |
45 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, | |
46 }; | |
47 | |
48 SkPoint* fVertices; | |
49 int32_t fMaxVertices; | |
50 GrTexture* fCurrTexture; | |
51 int fCurrVertex; | |
52 | |
53 SkIRect fClipRect; | |
54 GrContext::AutoMatrix fAutoMatrix; | |
55 }; | 38 }; |
56 | 39 |
57 #endif | 40 #endif |
OLD | NEW |