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