OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrAtlasTextContext_DEFINED | 8 #ifndef GrAtlasTextContext_DEFINED |
9 #define GrAtlasTextContext_DEFINED | 9 #define GrAtlasTextContext_DEFINED |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 class GrAtlasTextContext : public GrTextContext { | 31 class GrAtlasTextContext : public GrTextContext { |
32 public: | 32 public: |
33 static GrAtlasTextContext* Create(GrContext*, const SkSurfaceProps&); | 33 static GrAtlasTextContext* Create(GrContext*, const SkSurfaceProps&); |
34 | 34 |
35 private: | 35 private: |
36 GrAtlasTextContext(GrContext*, const SkSurfaceProps&); | 36 GrAtlasTextContext(GrContext*, const SkSurfaceProps&); |
37 ~GrAtlasTextContext() override {} | 37 ~GrAtlasTextContext() override {} |
38 | 38 |
39 bool canDraw(const SkPaint&, const SkMatrix& viewMatrix) override; | 39 bool canDraw(const SkPaint&, const SkMatrix& viewMatrix) override; |
40 | 40 |
41 void onDrawText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrPain
t&, const SkPaint&, | 41 void onDrawText(GrDrawContext*, const GrClip&, const GrPaint&, const SkPaint
&, |
42 const SkMatrix& viewMatrix, const char text[], size_t byteLe
ngth, | 42 const SkMatrix& viewMatrix, const char text[], size_t byteLe
ngth, |
43 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove
rride; | 43 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove
rride; |
44 void onDrawPosText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrP
aint&, | 44 void onDrawPosText(GrDrawContext*, const GrClip&, const GrPaint&, |
45 const SkPaint&, const SkMatrix& viewMatrix, | 45 const SkPaint&, const SkMatrix& viewMatrix, |
46 const char text[], size_t byteLength, | 46 const char text[], size_t byteLength, |
47 const SkScalar pos[], int scalarsPerPosition, | 47 const SkScalar pos[], int scalarsPerPosition, |
48 const SkPoint& offset, const SkIRect& regionClipBounds) o
verride; | 48 const SkPoint& offset, const SkIRect& regionClipBounds) o
verride; |
49 void drawTextBlob(GrDrawContext*, GrRenderTarget*, const GrClip&, const SkPa
int&, | 49 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&, |
50 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x,
SkScalar y, | 50 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x,
SkScalar y, |
51 SkDrawFilter*, const SkIRect& clipBounds) override; | 51 SkDrawFilter*, const SkIRect& clipBounds) override; |
52 | 52 |
53 typedef GrAtlasTextBlob::Run Run; | 53 typedef GrAtlasTextBlob::Run Run; |
54 typedef Run::SubRunInfo PerSubRunInfo; | 54 typedef Run::SubRunInfo PerSubRunInfo; |
55 | 55 |
56 inline bool canDrawAsDistanceFields(const SkPaint&, const SkMatrix& viewMatr
ix); | 56 inline bool canDrawAsDistanceFields(const SkPaint&, const SkMatrix& viewMatr
ix); |
57 GrAtlasTextBlob* setupDFBlob(int glyphCount, const SkPaint& origPaint, | 57 GrAtlasTextBlob* setupDFBlob(int glyphCount, const SkPaint& origPaint, |
58 const SkMatrix& viewMatrix, SkPaint* dfPaint, | 58 const SkMatrix& viewMatrix, SkPaint* dfPaint, |
59 SkScalar* textRatio); | 59 SkScalar* textRatio); |
(...skipping 19 matching lines...) Expand all Loading... |
79 int glyphCount, int run, int subRun, | 79 int glyphCount, int run, int subRun, |
80 GrColor, SkScalar transX, SkScalar transY, | 80 GrColor, SkScalar transX, SkScalar transY, |
81 const SkPaint&); | 81 const SkPaint&); |
82 inline void flushRun(GrDrawContext*, GrPipelineBuilder*, GrAtlasTextBlob*, i
nt run, GrColor, | 82 inline void flushRun(GrDrawContext*, GrPipelineBuilder*, GrAtlasTextBlob*, i
nt run, GrColor, |
83 SkScalar transX, SkScalar transY, const SkPaint&); | 83 SkScalar transX, SkScalar transY, const SkPaint&); |
84 inline void flushBigGlyphs(GrAtlasTextBlob* cacheBlob, GrDrawContext*, | 84 inline void flushBigGlyphs(GrAtlasTextBlob* cacheBlob, GrDrawContext*, |
85 const GrClip& clip, const SkPaint& skPaint, | 85 const GrClip& clip, const SkPaint& skPaint, |
86 SkScalar transX, SkScalar transY, const SkIRect&
clipBounds); | 86 SkScalar transX, SkScalar transY, const SkIRect&
clipBounds); |
87 | 87 |
88 // We have to flush SkTextBlobs differently from drawText / drawPosText | 88 // We have to flush SkTextBlobs differently from drawText / drawPosText |
89 void flush(const SkTextBlob*, GrAtlasTextBlob*, GrDrawContext*, GrRenderTarg
et*, | 89 void flush(const SkTextBlob*, GrAtlasTextBlob*, GrDrawContext*, |
90 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&, | 90 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&, |
91 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x
, SkScalar y, | 91 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x
, SkScalar y, |
92 SkScalar transX, SkScalar transY); | 92 SkScalar transX, SkScalar transY); |
93 void flush(GrAtlasTextBlob*, GrDrawContext*, GrRenderTarget*, const SkPaint&
, | 93 void flush(GrAtlasTextBlob*, GrDrawContext*, const SkPaint&, |
94 const GrPaint&, const GrClip&, const SkIRect& clipBounds); | 94 const GrPaint&, const GrClip&, const SkIRect& clipBounds); |
95 | 95 |
96 // A helper for drawing BitmapText in a run of distance fields | 96 // A helper for drawing BitmapText in a run of distance fields |
97 inline void fallbackDrawPosText(GrAtlasTextBlob*, int runIndex, | 97 inline void fallbackDrawPosText(GrAtlasTextBlob*, int runIndex, |
98 const GrClip&, GrColor color, | 98 const GrClip&, GrColor color, |
99 const SkPaint&, const SkMatrix& viewMatrix, | 99 const SkPaint&, const SkMatrix& viewMatrix, |
100 const SkTDArray<char>& fallbackTxt, | 100 const SkTDArray<char>& fallbackTxt, |
101 const SkTDArray<SkScalar>& fallbackPos, | 101 const SkTDArray<SkScalar>& fallbackPos, |
102 int scalarsPerPosition, | 102 int scalarsPerPosition, |
103 const SkPoint& offset); | 103 const SkPoint& offset); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 friend class GrAtlasTextBatch; | 184 friend class GrAtlasTextBatch; |
185 | 185 |
186 #ifdef GR_TEST_UTILS | 186 #ifdef GR_TEST_UTILS |
187 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); | 187 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); |
188 #endif | 188 #endif |
189 | 189 |
190 typedef GrTextContext INHERITED; | 190 typedef GrTextContext INHERITED; |
191 }; | 191 }; |
192 | 192 |
193 #endif | 193 #endif |
OLD | NEW |