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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 kDefaultRequestedGlyphs = 64, | 29 kDefaultRequestedGlyphs = 64, |
30 kMinRequestedVerts = kMinRequestedGlyphs * 4, | 30 kMinRequestedVerts = kMinRequestedGlyphs * 4, |
31 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, | 31 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, |
32 }; | 32 }; |
33 | 33 |
34 GrTextStrike* fStrike; | 34 GrTextStrike* fStrike; |
35 SkScalar fTextRatio; | 35 SkScalar fTextRatio; |
36 bool fUseLCDText; | 36 bool fUseLCDText; |
37 bool fEnableDFRendering; | 37 bool fEnableDFRendering; |
38 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; | 38 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; |
| 39 SkScalar* fDistanceAdjustTable; |
39 // Used to check whether fCachedEffect is still valid. | 40 // Used to check whether fCachedEffect is still valid. |
40 uint32_t fEffectTextureUniqueID; | 41 uint32_t fEffectTextureUniqueID; |
41 SkColor fEffectColor; | 42 SkColor fEffectColor; |
42 uint32_t fEffectFlags; | 43 uint32_t fEffectFlags; |
43 GrTexture* fGammaTexture; | |
44 void* fVertices; | 44 void* fVertices; |
45 int fCurrVertex; | 45 int fCurrVertex; |
46 int fAllocVertexCount; | 46 int fAllocVertexCount; |
47 int fTotalVertexCount; | 47 int fTotalVertexCount; |
48 GrTexture* fCurrTexture; | 48 GrTexture* fCurrTexture; |
49 SkRect fVertexBounds; | 49 SkRect fVertexBounds; |
50 SkMatrix fViewMatrix; | 50 SkMatrix fViewMatrix; |
51 | 51 |
52 GrDistanceFieldTextContext(GrContext*, SkGpuDevice*, const SkDevicePropertie
s&, bool enable); | 52 GrDistanceFieldTextContext(GrContext*, SkGpuDevice*, const SkDevicePropertie
s&, bool enable); |
| 53 void buildDistanceAdjustTable(); |
53 | 54 |
54 bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, | 55 bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, |
55 const SkPaint&, const SkMatrix& viewMatrix) override; | 56 const SkPaint&, const SkMatrix& viewMatrix) override; |
56 | 57 |
57 void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPain
t&, | 58 void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPain
t&, |
58 const SkMatrix& viewMatrix, | 59 const SkMatrix& viewMatrix, |
59 const char text[], size_t byteLength, | 60 const char text[], size_t byteLength, |
60 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove
rride; | 61 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove
rride; |
61 void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkP
aint&, | 62 void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkP
aint&, |
62 const SkMatrix& viewMatrix, | 63 const SkMatrix& viewMatrix, |
63 const char text[], size_t byteLength, | 64 const char text[], size_t byteLength, |
64 const SkScalar pos[], int scalarsPerPosition, | 65 const SkScalar pos[], int scalarsPerPosition, |
65 const SkPoint& offset, const SkIRect& regionClipBounds) o
verride; | 66 const SkPoint& offset, const SkIRect& regionClipBounds) o
verride; |
66 | 67 |
67 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | 68 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, |
68 const SkIRect& regionClipBounds); | 69 const SkIRect& regionClipBounds); |
69 bool appendGlyph(GrGlyph::PackedID, SkScalar left, SkScalar top, GrFontScale
r*); | 70 bool appendGlyph(GrGlyph::PackedID, SkScalar left, SkScalar top, GrFontScale
r*); |
70 bool uploadGlyph(GrGlyph*, GrFontScaler*); | 71 bool uploadGlyph(GrGlyph*, GrFontScaler*); |
71 void setupCoverageEffect(const SkColor& filteredColor); | 72 void setupCoverageEffect(const SkColor& filteredColor); |
72 void flush(); // automatically called by destructor | 73 void flush(); // automatically called by destructor |
73 void finish(); | 74 void finish(); |
74 }; | 75 }; |
75 | 76 |
76 #endif | 77 #endif |
OLD | NEW |