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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 | 166 |
167 private: | 167 private: |
168 static const int kMinSubRuns = 1; | 168 static const int kMinSubRuns = 1; |
169 static const int kMinSubRunStorage = kMinSubRuns * sizeof(SubRun
Info); | 169 static const int kMinSubRunStorage = kMinSubRuns * sizeof(SubRun
Info); |
170 SubRunInfo* fPtr; | 170 SubRunInfo* fPtr; |
171 SkAutoSTMalloc<kMinSubRunStorage, unsigned char> fSubRunStorage; | 171 SkAutoSTMalloc<kMinSubRunStorage, unsigned char> fSubRunStorage; |
172 int fSubRunCount; | 172 int fSubRunCount; |
173 int fSubRunAllocation; | 173 int fSubRunAllocation; |
174 }; | 174 }; |
| 175 SkAutoTUnref<GrBatchTextStrike> fStrike; |
175 SkAutoTUnref<SkTypeface> fTypeface; | 176 SkAutoTUnref<SkTypeface> fTypeface; |
176 SkRect fVertexBounds; | 177 SkRect fVertexBounds; |
177 SubRunInfoArray fSubRunInfo; | 178 SubRunInfoArray fSubRunInfo; |
178 SkAutoDescriptor fDescriptor; | 179 SkAutoDescriptor fDescriptor; |
179 GrColor fColor; | 180 GrColor fColor; |
180 bool fInitialized; | 181 bool fInitialized; |
181 bool fDrawAsPaths; | 182 bool fDrawAsPaths; |
182 }; | 183 }; |
183 | 184 |
184 struct BigGlyph { | 185 struct BigGlyph { |
(...skipping 22 matching lines...) Expand all Loading... |
207 }; | 208 }; |
208 | 209 |
209 struct StrokeInfo { | 210 struct StrokeInfo { |
210 SkScalar fFrameWidth; | 211 SkScalar fFrameWidth; |
211 SkScalar fMiterLimit; | 212 SkScalar fMiterLimit; |
212 SkPaint::Join fJoin; | 213 SkPaint::Join fJoin; |
213 }; | 214 }; |
214 | 215 |
215 // all glyph / vertex offsets are into these pools. | 216 // all glyph / vertex offsets are into these pools. |
216 unsigned char* fVertices; | 217 unsigned char* fVertices; |
217 GrGlyph::PackedID* fGlyphIDs; | 218 GrGlyph** fGlyphs; |
218 Run* fRuns; | 219 Run* fRuns; |
219 GrMemoryPool* fPool; | 220 GrMemoryPool* fPool; |
220 SkMaskFilter::BlurRec fBlurRec; | 221 SkMaskFilter::BlurRec fBlurRec; |
221 StrokeInfo fStrokeInfo; | 222 StrokeInfo fStrokeInfo; |
222 SkTArray<BigGlyph> fBigGlyphs; | 223 SkTArray<BigGlyph> fBigGlyphs; |
223 Key fKey; | 224 Key fKey; |
224 SkMatrix fViewMatrix; | 225 SkMatrix fViewMatrix; |
225 #ifdef SK_DEBUG | 226 #ifdef SK_DEBUG |
226 mutable SkScalar fTotalXError; | 227 mutable SkScalar fTotalXError; |
227 mutable SkScalar fTotalYError; | 228 mutable SkScalar fTotalYError; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 void bmpAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int le
ft, int top, | 269 void bmpAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int le
ft, int top, |
269 GrColor color, GrFontScaler*, const SkIRect& clipRect); | 270 GrColor color, GrFontScaler*, const SkIRect& clipRect); |
270 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala
r sx, SkScalar sy, | 271 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala
r sx, SkScalar sy, |
271 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk
Scalar textRatio, | 272 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk
Scalar textRatio, |
272 const SkMatrix& viewMatrix); | 273 const SkMatrix& viewMatrix); |
273 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph, | 274 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph, |
274 GrFontScaler* scaler, int x, int y); | 275 GrFontScaler* scaler, int x, int y); |
275 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*, | 276 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*, |
276 const SkRect& positions, GrColor color, | 277 const SkRect& positions, GrColor color, |
277 size_t vertexStride, bool useVertexColor, | 278 size_t vertexStride, bool useVertexColor, |
278 GrGlyph::PackedID); | 279 GrGlyph*); |
279 | 280 |
280 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&,
SkDrawFilter*, | 281 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&,
SkDrawFilter*, |
281 const SkMatrix& viewMatrix, const SkIRect& clipB
ounds, SkScalar x, | 282 const SkMatrix& viewMatrix, const SkIRect& clipB
ounds, SkScalar x, |
282 SkScalar y); | 283 SkScalar y); |
283 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int
run, GrColor, | 284 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int
run, GrColor, |
284 SkScalar transX, SkScalar transY, const SkPaint&); | 285 SkScalar transX, SkScalar transY, const SkPaint&); |
285 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt, | 286 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt, |
286 const GrPaint& grPaint, const GrClip& clip, | 287 const GrPaint& grPaint, const GrClip& clip, |
287 SkScalar transX, SkScalar transY); | 288 SkScalar transX, SkScalar transY); |
288 | 289 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 bool fEnableDFRendering; | 372 bool fEnableDFRendering; |
372 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; | 373 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; |
373 | 374 |
374 friend class GrTextBlobCache; | 375 friend class GrTextBlobCache; |
375 friend class BitmapTextBatch; | 376 friend class BitmapTextBatch; |
376 | 377 |
377 typedef GrTextContext INHERITED; | 378 typedef GrTextContext INHERITED; |
378 }; | 379 }; |
379 | 380 |
380 #endif | 381 #endif |
OLD | NEW |