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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 55 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
56 GrClip fClip; | 56 GrClip fClip; |
57 GrDrawTarget* fDrawTarget; | 57 GrDrawTarget* fDrawTarget; |
58 SkIRect fClipRect; | 58 SkIRect fClipRect; |
59 SkIRect fRegionClipBounds; | 59 SkIRect fRegionClipBounds; |
60 GrPaint fPaint; | 60 GrPaint fPaint; |
61 SkPaint fSkPaint; | 61 SkPaint fSkPaint; |
62 | 62 |
63 GrTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&); | 63 GrTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&); |
64 | 64 |
65 virtual bool canDraw(const SkPaint& paint, const SkMatrix& viewMatrix) = 0; | 65 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, |
| 66 const SkPaint&, const SkMatrix& viewMatrix) = 0; |
66 | 67 |
67 virtual void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, cons
t SkPaint&, | 68 virtual void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, cons
t SkPaint&, |
68 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, | 69 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, |
69 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; | 70 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; |
70 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, c
onst SkPaint&, | 71 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, c
onst SkPaint&, |
71 const SkMatrix& viewMatrix, | 72 const SkMatrix& viewMatrix, |
72 const char text[], size_t byteLength, | 73 const char text[], size_t byteLength, |
73 const SkScalar pos[], int scalarsPerPosition, | 74 const SkScalar pos[], int scalarsPerPosition, |
74 const SkPoint& offset, const SkIRect& clipBounds)
= 0; | 75 const SkPoint& offset, const SkIRect& clipBounds)
= 0; |
75 virtual void onDrawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&, | |
76 const SkMatrix& viewMatrix, const SkTextBlob*, | |
77 SkScalar x, SkScalar y, SkDrawFilter*, const SkI
Rect& clipBounds); | |
78 | 76 |
79 void drawTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, | 77 void drawTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, |
80 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, | 78 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, |
81 const SkIRect& clipBounds); | 79 const SkIRect& clipBounds); |
82 void drawPosTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, | 80 void drawPosTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, |
83 const char text[], size_t byteLength, | 81 const char text[], size_t byteLength, |
84 const SkScalar pos[], int scalarsPerPosition, | 82 const SkScalar pos[], int scalarsPerPosition, |
85 const SkPoint& offset, const SkIRect& clipBounds); | 83 const SkPoint& offset, const SkIRect& clipBounds); |
86 | 84 |
87 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | 85 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, |
88 const SkIRect& regionClipBounds); | 86 const SkIRect& regionClipBounds); |
89 void finish() { fDrawTarget = NULL; } | 87 void finish() { fDrawTarget = NULL; } |
90 | 88 |
91 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | 89 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); |
92 // sets extent in stopVector and returns glyph count | 90 // sets extent in stopVector and returns glyph count |
93 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, | 91 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
94 const char text[], size_t byteLength, SkVector* stopV
ector); | 92 const char text[], size_t byteLength, SkVector* stopV
ector); |
95 }; | 93 }; |
96 | 94 |
97 #endif | 95 #endif |
OLD | NEW |