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 |
11 #include "GrTextContext.h" | 11 #include "GrTextContext.h" |
12 | 12 |
13 #include "GrBatchAtlas.h" | 13 #include "GrBatchAtlas.h" |
| 14 #include "GrBatchFontCache.h" |
14 #include "GrGeometryProcessor.h" | 15 #include "GrGeometryProcessor.h" |
15 #include "SkDescriptor.h" | 16 #include "SkDescriptor.h" |
16 #include "GrMemoryPool.h" | 17 #include "GrMemoryPool.h" |
17 #include "SkMaskFilter.h" | 18 #include "SkMaskFilter.h" |
18 #include "SkTextBlob.h" | 19 #include "SkTextBlob.h" |
19 #include "SkTInternalLList.h" | 20 #include "SkTInternalLList.h" |
20 | 21 |
21 class GrBatchTextStrike; | |
22 class GrPipelineBuilder; | 22 class GrPipelineBuilder; |
23 class GrTextBlobCache; | 23 class GrTextBlobCache; |
24 | 24 |
25 /* | 25 /* |
26 * This class implements GrTextContext using standard bitmap fonts, and can also
process textblobs. | 26 * This class implements GrTextContext using standard bitmap fonts, and can also
process textblobs. |
27 * TODO replace GrBitmapTextContext | 27 * TODO replace GrBitmapTextContext |
28 */ | 28 */ |
29 class GrAtlasTextContext : public GrTextContext { | 29 class GrAtlasTextContext : public GrTextContext { |
30 public: | 30 public: |
31 static GrAtlasTextContext* Create(GrContext*, SkGpuDevice*, const SkDevicePr
operties&, | 31 static GrAtlasTextContext* Create(GrContext*, SkGpuDevice*, const SkDevicePr
operties&, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 private: | 170 private: |
171 static const int kMinSubRuns = 1; | 171 static const int kMinSubRuns = 1; |
172 static const int kMinSubRunStorage = kMinSubRuns * sizeof(SubRun
Info); | 172 static const int kMinSubRunStorage = kMinSubRuns * sizeof(SubRun
Info); |
173 SubRunInfo* fPtr; | 173 SubRunInfo* fPtr; |
174 SkAutoSTMalloc<kMinSubRunStorage, unsigned char> fSubRunStorage; | 174 SkAutoSTMalloc<kMinSubRunStorage, unsigned char> fSubRunStorage; |
175 int fSubRunCount; | 175 int fSubRunCount; |
176 int fSubRunAllocation; | 176 int fSubRunAllocation; |
177 }; | 177 }; |
| 178 SkAutoTUnref<GrBatchTextStrike> fStrike; |
178 SkAutoTUnref<SkTypeface> fTypeface; | 179 SkAutoTUnref<SkTypeface> fTypeface; |
179 SkRect fVertexBounds; | 180 SkRect fVertexBounds; |
180 SubRunInfoArray fSubRunInfo; | 181 SubRunInfoArray fSubRunInfo; |
181 SkAutoDescriptor fDescriptor; | 182 SkAutoDescriptor fDescriptor; |
182 GrColor fColor; | 183 GrColor fColor; |
183 bool fInitialized; | 184 bool fInitialized; |
184 bool fDrawAsPaths; | 185 bool fDrawAsPaths; |
185 }; | 186 }; |
186 | 187 |
187 struct BigGlyph { | 188 struct BigGlyph { |
(...skipping 27 matching lines...) Expand all Loading... |
215 SkPaint::Join fJoin; | 216 SkPaint::Join fJoin; |
216 }; | 217 }; |
217 | 218 |
218 enum TextType { | 219 enum TextType { |
219 kHasDistanceField_TextType = 0x1, | 220 kHasDistanceField_TextType = 0x1, |
220 kHasBitmap_TextType = 0x2, | 221 kHasBitmap_TextType = 0x2, |
221 }; | 222 }; |
222 | 223 |
223 // all glyph / vertex offsets are into these pools. | 224 // all glyph / vertex offsets are into these pools. |
224 unsigned char* fVertices; | 225 unsigned char* fVertices; |
225 GrGlyph::PackedID* fGlyphIDs; | 226 GrGlyph** fGlyphs; |
226 Run* fRuns; | 227 Run* fRuns; |
227 GrMemoryPool* fPool; | 228 GrMemoryPool* fPool; |
228 SkMaskFilter::BlurRec fBlurRec; | 229 SkMaskFilter::BlurRec fBlurRec; |
229 StrokeInfo fStrokeInfo; | 230 StrokeInfo fStrokeInfo; |
230 SkTArray<BigGlyph> fBigGlyphs; | 231 SkTArray<BigGlyph> fBigGlyphs; |
231 Key fKey; | 232 Key fKey; |
232 SkMatrix fViewMatrix; | 233 SkMatrix fViewMatrix; |
233 #ifdef SK_DEBUG | 234 #ifdef SK_DEBUG |
234 mutable SkScalar fTotalXError; | 235 mutable SkScalar fTotalXError; |
235 mutable SkScalar fTotalYError; | 236 mutable SkScalar fTotalYError; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void bmpAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int le
ft, int top, | 281 void bmpAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int le
ft, int top, |
281 GrColor color, GrFontScaler*, const SkIRect& clipRect); | 282 GrColor color, GrFontScaler*, const SkIRect& clipRect); |
282 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala
r sx, SkScalar sy, | 283 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala
r sx, SkScalar sy, |
283 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk
Scalar textRatio, | 284 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk
Scalar textRatio, |
284 const SkMatrix& viewMatrix); | 285 const SkMatrix& viewMatrix); |
285 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph, | 286 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph, |
286 GrFontScaler* scaler, int x, int y); | 287 GrFontScaler* scaler, int x, int y); |
287 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*, | 288 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*, |
288 const SkRect& positions, GrColor color, | 289 const SkRect& positions, GrColor color, |
289 size_t vertexStride, bool useVertexColor, | 290 size_t vertexStride, bool useVertexColor, |
290 GrGlyph::PackedID); | 291 GrGlyph*); |
291 | 292 |
292 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&,
SkDrawFilter*, | 293 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&,
SkDrawFilter*, |
293 const SkMatrix& viewMatrix, const SkIRect& clipB
ounds, SkScalar x, | 294 const SkMatrix& viewMatrix, const SkIRect& clipB
ounds, SkScalar x, |
294 SkScalar y); | 295 SkScalar y); |
295 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int
run, GrColor, | 296 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int
run, GrColor, |
296 SkScalar transX, SkScalar transY, const SkPaint&); | 297 SkScalar transX, SkScalar transY, const SkPaint&); |
297 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt, | 298 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt, |
298 const GrPaint& grPaint, const GrClip& clip, | 299 const GrPaint& grPaint, const GrClip& clip, |
299 SkScalar transX, SkScalar transY); | 300 SkScalar transX, SkScalar transY); |
300 | 301 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 bool fEnableDFRendering; | 384 bool fEnableDFRendering; |
384 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; | 385 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; |
385 | 386 |
386 friend class GrTextBlobCache; | 387 friend class GrTextBlobCache; |
387 friend class BitmapTextBatch; | 388 friend class BitmapTextBatch; |
388 | 389 |
389 typedef GrTextContext INHERITED; | 390 typedef GrTextContext INHERITED; |
390 }; | 391 }; |
391 | 392 |
392 #endif | 393 #endif |
OLD | NEW |