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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // We have to flush SkTextBlobs differently from drawText / drawPosText | 89 // We have to flush SkTextBlobs differently from drawText / drawPosText |
90 void flush(const SkTextBlob*, GrAtlasTextBlob*, GrRenderTarget*, | 90 void flush(const SkTextBlob*, GrAtlasTextBlob*, GrRenderTarget*, |
91 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&, | 91 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&, |
92 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x
, SkScalar y, | 92 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x
, SkScalar y, |
93 SkScalar transX, SkScalar transY); | 93 SkScalar transX, SkScalar transY); |
94 void flush(GrAtlasTextBlob*, GrRenderTarget*, const SkPaint&, | 94 void flush(GrAtlasTextBlob*, GrRenderTarget*, const SkPaint&, |
95 const GrPaint&, const GrClip&, const SkIRect& clipBounds); | 95 const GrPaint&, const GrClip&, const SkIRect& clipBounds); |
96 | 96 |
97 // A helper for drawing BitmapText in a run of distance fields | 97 // A helper for drawing BitmapText in a run of distance fields |
98 inline void fallbackDrawPosText(GrAtlasTextBlob*, int runIndex, | 98 inline void fallbackDrawPosText(GrAtlasTextBlob*, int runIndex, |
99 GrRenderTarget*, const GrClip&, | 99 GrRenderTarget*, const GrClip&, GrColor colo
r, |
100 const GrPaint&, | |
101 const SkPaint&, const SkMatrix& viewMatrix, | 100 const SkPaint&, const SkMatrix& viewMatrix, |
102 const SkTDArray<char>& fallbackTxt, | 101 const SkTDArray<char>& fallbackTxt, |
103 const SkTDArray<SkScalar>& fallbackPos, | 102 const SkTDArray<SkScalar>& fallbackPos, |
104 int scalarsPerPosition, | 103 int scalarsPerPosition, |
105 const SkPoint& offset, | 104 const SkPoint& offset, |
106 const SkIRect& clipRect); | 105 const SkIRect& clipRect); |
107 | 106 |
108 void internalDrawBMPText(GrAtlasTextBlob*, int runIndex, SkGlyphCache*, cons
t SkPaint&, | 107 void internalDrawBMPText(GrAtlasTextBlob*, int runIndex, SkGlyphCache*, cons
t SkPaint&, |
109 GrColor color, const SkMatrix& viewMatrix, | 108 GrColor color, const SkMatrix& viewMatrix, |
110 const char text[], size_t byteLength, | 109 const char text[], size_t byteLength, |
(...skipping 18 matching lines...) Expand all Loading... |
129 const SkScalar pos[], int scalarsPerPosition, | 128 const SkScalar pos[], int scalarsPerPosition, |
130 const SkPoint& offset, const SkIRect& clipRect, | 129 const SkPoint& offset, const SkIRect& clipRect, |
131 SkScalar textRatio, | 130 SkScalar textRatio, |
132 SkTDArray<char>* fallbackTxt, | 131 SkTDArray<char>* fallbackTxt, |
133 SkTDArray<SkScalar>* fallbackPos); | 132 SkTDArray<SkScalar>* fallbackPos); |
134 | 133 |
135 // sets up the descriptor on the blob and returns a detached cache. Client
must attach | 134 // sets up the descriptor on the blob and returns a detached cache. Client
must attach |
136 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); | 135 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); |
137 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa
trix, bool noGamma); | 136 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa
trix, bool noGamma); |
138 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran
sY, | 137 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran
sY, |
139 const GrAtlasTextBlob&, const SkPaint&
, | 138 const GrAtlasTextBlob&, const SkPaint&
, GrColor, |
140 const SkMaskFilter::BlurRec&, | 139 const SkMaskFilter::BlurRec&, |
141 const SkMatrix& viewMatrix, SkScalar x
, SkScalar y); | 140 const SkMatrix& viewMatrix, SkScalar x
, SkScalar y); |
142 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo
r, | 141 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo
r, |
143 const SkMatrix& viewMatrix, | 142 const SkMatrix& viewMatrix, |
144 const SkTextBlob* blob, SkScalar x, SkScalar y, | 143 const SkTextBlob* blob, SkScalar x, SkScalar y, |
145 SkDrawFilter* drawFilter, const SkIRect& clipRect, G
rRenderTarget*, | 144 SkDrawFilter* drawFilter, const SkIRect& clipRect, G
rRenderTarget*, |
146 const GrClip&, const GrPaint&); | 145 const GrClip&); |
147 inline static bool HasLCD(const SkTextBlob*); | 146 inline static bool HasLCD(const SkTextBlob*); |
148 inline void initDistanceFieldPaint(GrAtlasTextBlob*, SkPaint*, SkScalar* tex
tRatio, | 147 inline void initDistanceFieldPaint(GrAtlasTextBlob*, SkPaint*, SkScalar* tex
tRatio, |
149 const SkMatrix&); | 148 const SkMatrix&); |
150 | 149 |
151 // Test methods | 150 // Test methods |
152 // TODO this is really ugly. It'd be much nicer if positioning could be mov
ed to batch | 151 // TODO this is really ugly. It'd be much nicer if positioning could be mov
ed to batch |
153 inline GrAtlasTextBlob* createDrawTextBlob(GrRenderTarget*, const GrClip&, c
onst GrPaint&, | 152 inline GrAtlasTextBlob* createDrawTextBlob(GrRenderTarget*, const GrClip&, c
onst GrPaint&, |
154 const SkPaint&, const SkMatrix& vi
ewMatrix, | 153 const SkPaint&, const SkMatrix& vi
ewMatrix, |
155 const char text[], size_t byteLeng
th, | 154 const char text[], size_t byteLeng
th, |
156 SkScalar x, SkScalar y, | 155 SkScalar x, SkScalar y, |
(...skipping 30 matching lines...) Expand all Loading... |
187 friend class TextBatch; | 186 friend class TextBatch; |
188 | 187 |
189 #ifdef GR_TEST_UTILS | 188 #ifdef GR_TEST_UTILS |
190 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); | 189 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); |
191 #endif | 190 #endif |
192 | 191 |
193 typedef GrTextContext INHERITED; | 192 typedef GrTextContext INHERITED; |
194 }; | 193 }; |
195 | 194 |
196 #endif | 195 #endif |
OLD | NEW |