OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrStencilAndCoverTextContext_DEFINED | 8 #ifndef GrStencilAndCoverTextContext_DEFINED |
9 #define GrStencilAndCoverTextContext_DEFINED | 9 #define GrStencilAndCoverTextContext_DEFINED |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 class GrTextStrike; | 22 class GrTextStrike; |
23 class GrPath; | 23 class GrPath; |
24 class SkSurfaceProps; | 24 class SkSurfaceProps; |
25 | 25 |
26 /* | 26 /* |
27 * This class implements text rendering using stencil and cover path rendering | 27 * This class implements text rendering using stencil and cover path rendering |
28 * (by the means of GrDrawTarget::drawPath). | 28 * (by the means of GrDrawTarget::drawPath). |
29 */ | 29 */ |
30 class GrStencilAndCoverTextContext { | 30 class GrStencilAndCoverTextContext { |
31 public: | 31 public: |
32 static GrStencilAndCoverTextContext* Create(); | 32 static GrStencilAndCoverTextContext* Create(GrAtlasTextContext* fallbackText
Context); |
33 | 33 |
34 void drawText(GrContext*, GrDrawContext* dc, | 34 void drawText(GrContext*, GrDrawContext* dc, |
35 const GrClip&, const GrPaint&, const SkPaint&, | 35 const GrClip&, const GrPaint&, const SkPaint&, |
36 const SkMatrix& viewMatrix, const SkSurfaceProps&, const char
text[], | 36 const SkMatrix& viewMatrix, const SkSurfaceProps&, const char
text[], |
37 size_t byteLength, SkScalar x, | 37 size_t byteLength, SkScalar x, |
38 SkScalar y, const SkIRect& clipBounds); | 38 SkScalar y, const SkIRect& clipBounds); |
39 void drawPosText(GrContext*, GrDrawContext*, | 39 void drawPosText(GrContext*, GrDrawContext*, |
40 const GrClip&, const GrPaint&, const SkPaint&, | 40 const GrClip&, const GrPaint&, const SkPaint&, |
41 const SkMatrix& viewMatrix, const SkSurfaceProps&, | 41 const SkMatrix& viewMatrix, const SkSurfaceProps&, |
42 const char text[], size_t byteLength, | 42 const char text[], size_t byteLength, |
43 const SkScalar pos[], int scalarsPerPosition, | 43 const SkScalar pos[], int scalarsPerPosition, |
44 const SkPoint& offset, const SkIRect& clipBounds); | 44 const SkPoint& offset, const SkIRect& clipBounds); |
45 void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&, | 45 void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&, |
46 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S
kTextBlob*, | 46 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S
kTextBlob*, |
47 SkScalar x, SkScalar y, | 47 SkScalar x, SkScalar y, |
48 SkDrawFilter*, const SkIRect& clipBounds); | 48 SkDrawFilter*, const SkIRect& clipBounds); |
49 | 49 |
50 virtual ~GrStencilAndCoverTextContext(); | 50 virtual ~GrStencilAndCoverTextContext(); |
51 | 51 |
52 private: | 52 private: |
53 GrStencilAndCoverTextContext(); | 53 GrStencilAndCoverTextContext(GrAtlasTextContext* fallbackTextContext); |
54 | 54 |
55 bool canDraw(const SkPaint& skPaint, const SkMatrix&) { | 55 bool canDraw(const SkPaint& skPaint, const SkMatrix&) { |
56 return this->internalCanDraw(skPaint); | 56 return this->internalCanDraw(skPaint); |
57 } | 57 } |
58 | 58 |
59 bool internalCanDraw(const SkPaint&); | 59 bool internalCanDraw(const SkPaint&); |
60 | 60 |
61 void uncachedDrawTextBlob(GrContext*, GrDrawContext* dc, | 61 void uncachedDrawTextBlob(GrContext*, GrDrawContext* dc, |
62 const GrClip& clip, const SkPaint& skPaint, | 62 const GrClip& clip, const SkPaint& skPaint, |
63 const SkMatrix& viewMatrix, | 63 const SkMatrix& viewMatrix, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void purgeToFit(const TextBlob&); | 151 void purgeToFit(const TextBlob&); |
152 | 152 |
153 GrAtlasTextContext* fFallbackTextConte
xt; | 153 GrAtlasTextContext* fFallbackTextConte
xt; |
154 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache; | 154 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache; |
155 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache; | 155 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache; |
156 SkTInternalLList<TextBlob> fLRUList; | 156 SkTInternalLList<TextBlob> fLRUList; |
157 size_t fCacheSize; | 157 size_t fCacheSize; |
158 }; | 158 }; |
159 | 159 |
160 #endif | 160 #endif |
OLD | NEW |