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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 SkScalar x, SkScalar y, | 41 SkScalar x, SkScalar y, |
42 SkDrawFilter*, const SkIRect& clipBounds); | 42 SkDrawFilter*, const SkIRect& clipBounds); |
43 | 43 |
44 static bool ShouldDisableLCD(const SkPaint& paint); | 44 static bool ShouldDisableLCD(const SkPaint& paint); |
45 | 45 |
46 protected: | 46 protected: |
47 GrTextContext* fFallbackTextContext; | 47 GrTextContext* fFallbackTextContext; |
48 GrContext* fContext; | 48 GrContext* fContext; |
49 SkDeviceProperties fDeviceProperties; | 49 SkDeviceProperties fDeviceProperties; |
50 | 50 |
| 51 GrDrawContext* fDrawContext; // owning drawContext |
51 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 52 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
52 GrClip fClip; | 53 GrClip fClip; |
53 SkIRect fClipRect; | 54 SkIRect fClipRect; |
54 SkIRect fRegionClipBounds; | 55 SkIRect fRegionClipBounds; |
55 GrPaint fPaint; | 56 GrPaint fPaint; |
56 SkPaint fSkPaint; | 57 SkPaint fSkPaint; |
57 | 58 |
58 GrTextContext(GrContext*, const SkDeviceProperties&); | 59 GrTextContext(GrContext*, GrDrawContext*, const SkDeviceProperties&); |
59 | 60 |
60 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, | 61 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, |
61 const SkPaint&, const SkMatrix& viewMatrix) = 0; | 62 const SkPaint&, const SkMatrix& viewMatrix) = 0; |
62 | 63 |
63 virtual void onDrawText(GrDrawContext*, GrRenderTarget*, const GrClip&, | 64 virtual void onDrawText(GrRenderTarget*, const GrClip&, |
64 const GrPaint&, const SkPaint&, | 65 const GrPaint&, const SkPaint&, |
65 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, | 66 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, |
66 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; | 67 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; |
67 virtual void onDrawPosText(GrDrawContext*, GrRenderTarget*, const GrClip&, | 68 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, |
68 const GrPaint&, const SkPaint&, | 69 const GrPaint&, const SkPaint&, |
69 const SkMatrix& viewMatrix, | 70 const SkMatrix& viewMatrix, |
70 const char text[], size_t byteLength, | 71 const char text[], size_t byteLength, |
71 const SkScalar pos[], int scalarsPerPosition, | 72 const SkScalar pos[], int scalarsPerPosition, |
72 const SkPoint& offset, const SkIRect& clipBounds)
= 0; | 73 const SkPoint& offset, const SkIRect& clipBounds)
= 0; |
73 | 74 |
74 void drawTextAsPath(GrDrawContext*, GrRenderTarget*, const GrClip& clip, | 75 void drawTextAsPath(GrRenderTarget*, const GrClip& clip, |
75 const SkPaint& origPaint, const SkMatrix& viewMatrix, | 76 const SkPaint& origPaint, const SkMatrix& viewMatrix, |
76 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, | 77 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, |
77 const SkIRect& clipBounds); | 78 const SkIRect& clipBounds); |
78 void drawPosTextAsPath(GrDrawContext*, GrRenderTarget*, const GrClip& clip, | 79 void drawPosTextAsPath(GrRenderTarget*, const GrClip& clip, |
79 const SkPaint& origPaint, const SkMatrix& viewMatrix, | 80 const SkPaint& origPaint, const SkMatrix& viewMatrix, |
80 const char text[], size_t byteLength, | 81 const char text[], size_t byteLength, |
81 const SkScalar pos[], int scalarsPerPosition, | 82 const SkScalar pos[], int scalarsPerPosition, |
82 const SkPoint& offset, const SkIRect& clipBounds); | 83 const SkPoint& offset, const SkIRect& clipBounds); |
83 | 84 |
84 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | 85 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, |
85 const SkIRect& regionClipBounds); | 86 const SkIRect& regionClipBounds); |
86 | 87 |
87 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | 88 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); |
88 // sets extent in stopVector and returns glyph count | 89 // sets extent in stopVector and returns glyph count |
89 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, | 90 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
90 const char text[], size_t byteLength, SkVector* stopV
ector); | 91 const char text[], size_t byteLength, SkVector* stopV
ector); |
91 static uint32_t FilterTextFlags(const SkDeviceProperties& devProps, const Sk
Paint& paint); | 92 static uint32_t FilterTextFlags(const SkDeviceProperties& devProps, const Sk
Paint& paint); |
92 | 93 |
93 friend class BitmapTextBatch; | 94 friend class BitmapTextBatch; |
94 }; | 95 }; |
95 | 96 |
96 #endif | 97 #endif |
OLD | NEW |