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 13 matching lines...) Expand all Loading... | |
24 class GrDrawTarget; | 24 class GrDrawTarget; |
25 class GrPipelineBuilder; | 25 class GrPipelineBuilder; |
26 class GrTextBlobCache; | 26 class GrTextBlobCache; |
27 class SkGlyph; | 27 class SkGlyph; |
28 | 28 |
29 /* | 29 /* |
30 * This class implements GrTextContext using standard bitmap fonts, and can also process textblobs. | 30 * This class implements GrTextContext using standard bitmap fonts, and can also process textblobs. |
31 */ | 31 */ |
32 class GrAtlasTextContext : public GrTextContext { | 32 class GrAtlasTextContext : public GrTextContext { |
33 public: | 33 public: |
34 static GrAtlasTextContext* Create(GrContext*); | 34 static GrAtlasTextContext* Create(); |
35 | 35 |
robertphillips
2016/02/10 19:44:39
private for canDraw ?
| |
36 bool canDraw(const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProp s&); | 36 bool canDraw(const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProp s&, |
37 void drawText(GrDrawContext*, const GrClip&, const GrPaint&, const SkPaint&, | 37 const GrShaderCaps&); |
38 void drawText(GrContext*, GrDrawContext*, const GrClip&, const GrPaint&, con st SkPaint&, | |
38 const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[], | 39 const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[], |
39 size_t byteLength, SkScalar x, SkScalar y, | 40 size_t byteLength, SkScalar x, SkScalar y, |
40 const SkIRect& regionClipBounds) override; | 41 const SkIRect& regionClipBounds) override; |
41 void drawPosText(GrDrawContext*, const GrClip&, const GrPaint&, | 42 void drawPosText(GrContext*, GrDrawContext*, const GrClip&, const GrPaint&, |
42 const SkPaint&, const SkMatrix& viewMatrix, const SkSurface Props&, | 43 const SkPaint&, const SkMatrix& viewMatrix, const SkSurface Props&, |
43 const char text[], size_t byteLength, | 44 const char text[], size_t byteLength, |
44 const SkScalar pos[], int scalarsPerPosition, | 45 const SkScalar pos[], int scalarsPerPosition, |
45 const SkPoint& offset, const SkIRect& regionClipBounds) ove rride; | 46 const SkPoint& offset, const SkIRect& regionClipBounds) ove rride; |
46 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&, | 47 void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&, |
47 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S kTextBlob*, | 48 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S kTextBlob*, |
48 SkScalar x, SkScalar y, | 49 SkScalar x, SkScalar y, |
49 SkDrawFilter*, const SkIRect& clipBounds) override; | 50 SkDrawFilter*, const SkIRect& clipBounds) override; |
50 | 51 |
51 private: | 52 private: |
52 GrAtlasTextContext(GrContext*); | 53 GrAtlasTextContext(); |
53 | 54 |
54 // sets up the descriptor on the blob and returns a detached cache. Client must attach | 55 // sets up the descriptor on the blob and returns a detached cache. Client must attach |
55 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); | 56 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); |
56 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo r, | 57 void regenerateTextBlob(GrAtlasTextBlob* bmp, |
58 GrBatchFontCache*, | |
59 const GrShaderCaps&, | |
60 const SkPaint& skPaint, GrColor, | |
57 const SkMatrix& viewMatrix, | 61 const SkMatrix& viewMatrix, |
58 const SkSurfaceProps&, | 62 const SkSurfaceProps&, |
59 const SkTextBlob* blob, SkScalar x, SkScalar y, | 63 const SkTextBlob* blob, SkScalar x, SkScalar y, |
60 SkDrawFilter* drawFilter); | 64 SkDrawFilter* drawFilter); |
61 inline static bool HasLCD(const SkTextBlob*); | 65 inline static bool HasLCD(const SkTextBlob*); |
62 | 66 |
robertphillips
2016/02/10 19:44:39
IIUC these aren't just test methods.
| |
63 // Test methods | 67 // Test methods |
64 inline GrAtlasTextBlob* createDrawTextBlob(const GrPaint&, | 68 inline GrAtlasTextBlob* createDrawTextBlob(GrTextBlobCache*, |
69 GrBatchFontCache*, const GrShader Caps&, | |
70 const GrPaint&, | |
65 const SkPaint&, const SkMatrix& v iewMatrix, | 71 const SkPaint&, const SkMatrix& v iewMatrix, |
66 const SkSurfaceProps&, | 72 const SkSurfaceProps&, |
67 const char text[], size_t byteLen gth, | 73 const char text[], size_t byteLen gth, |
68 SkScalar x, SkScalar y); | 74 SkScalar x, SkScalar y); |
69 inline GrAtlasTextBlob* createDrawPosTextBlob(const GrPaint&, | 75 inline GrAtlasTextBlob* createDrawPosTextBlob(GrTextBlobCache*, GrBatchFontC ache*, |
76 const GrShaderCaps&, | |
77 const GrPaint&, | |
70 const SkPaint&, const SkMatrix & viewMatrix, | 78 const SkPaint&, const SkMatrix & viewMatrix, |
71 const SkSurfaceProps&, | 79 const SkSurfaceProps&, |
72 const char text[], size_t byte Length, | 80 const char text[], size_t byte Length, |
73 const SkScalar pos[], int scal arsPerPosition, | 81 const SkScalar pos[], int scal arsPerPosition, |
74 const SkPoint& offset); | 82 const SkPoint& offset); |
75 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; } | 83 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; } |
76 | 84 |
77 GrTextBlobCache* fCache; | |
78 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; | 85 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; |
79 | 86 |
80 #ifdef GR_TEST_UTILS | 87 #ifdef GR_TEST_UTILS |
81 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); | 88 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); |
82 #endif | 89 #endif |
83 | 90 |
84 typedef GrTextContext INHERITED; | 91 typedef GrTextContext INHERITED; |
85 }; | 92 }; |
86 | 93 |
87 #endif | 94 #endif |
OLD | NEW |