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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 SkScalar fY; | 202 SkScalar fY; |
203 int fRunCount; | 203 int fRunCount; |
204 SkMaskFilter::BlurRec fBlurRec; | 204 SkMaskFilter::BlurRec fBlurRec; |
205 struct StrokeInfo { | 205 struct StrokeInfo { |
206 SkScalar fFrameWidth; | 206 SkScalar fFrameWidth; |
207 SkScalar fMiterLimit; | 207 SkScalar fMiterLimit; |
208 SkPaint::Join fJoin; | 208 SkPaint::Join fJoin; |
209 }; | 209 }; |
210 StrokeInfo fStrokeInfo; | 210 StrokeInfo fStrokeInfo; |
211 GrMemoryPool* fPool; | 211 GrMemoryPool* fPool; |
212 bool fHasDistanceField; | |
jvanverth1
2015/04/20 17:54:07
I think a bitfield and an enum with two values wou
| |
213 bool fHasBitmap; | |
214 | |
215 BitmapTextBlob() : fHasDistanceField(false), fHasBitmap(false) {} | |
212 | 216 |
213 // all glyph / vertex offsets are into these pools. | 217 // all glyph / vertex offsets are into these pools. |
214 unsigned char* fVertices; | 218 unsigned char* fVertices; |
215 GrGlyph::PackedID* fGlyphIDs; | 219 GrGlyph::PackedID* fGlyphIDs; |
216 Run* fRuns; | 220 Run* fRuns; |
217 | 221 |
218 struct Key { | 222 struct Key { |
219 Key() { | 223 Key() { |
220 sk_bzero(this, sizeof(Key)); | 224 sk_bzero(this, sizeof(Key)); |
221 } | 225 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 SkScalar transX, SkScalar transY); | 290 SkScalar transX, SkScalar transY); |
287 | 291 |
288 // We have to flush SkTextBlobs differently from drawText / drawPosText | 292 // We have to flush SkTextBlobs differently from drawText / drawPosText |
289 void flush(GrDrawTarget*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget *, const SkPaint&, | 293 void flush(GrDrawTarget*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget *, const SkPaint&, |
290 const GrPaint&, SkDrawFilter*, const GrClip&, const SkMatrix& vie wMatrix, | 294 const GrPaint&, SkDrawFilter*, const GrClip&, const SkMatrix& vie wMatrix, |
291 const SkIRect& clipBounds, SkScalar x, SkScalar y, SkScalar trans X, SkScalar transY); | 295 const SkIRect& clipBounds, SkScalar x, SkScalar y, SkScalar trans X, SkScalar transY); |
292 void flush(GrDrawTarget*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&, | 296 void flush(GrDrawTarget*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&, |
293 const GrPaint&, const GrClip&); | 297 const GrPaint&, const GrClip&); |
294 | 298 |
295 // A helper for drawing BitmapText in a run of distance fields | 299 // A helper for drawing BitmapText in a run of distance fields |
296 inline void fallbackDrawPosText(BitmapTextBlob*, GrRenderTarget*, const GrCl ip&, | 300 inline void fallbackDrawPosText(BitmapTextBlob*, int runIndex, |
301 GrRenderTarget*, const GrClip&, | |
297 const GrPaint&, | 302 const GrPaint&, |
298 const SkPaint&, const SkMatrix& viewMatrix, | 303 const SkPaint&, const SkMatrix& viewMatrix, |
299 const SkTDArray<char>& fallbackTxt, | 304 const SkTDArray<char>& fallbackTxt, |
300 const SkTDArray<SkScalar>& fallbackPos, | 305 const SkTDArray<SkScalar>& fallbackPos, |
301 int scalarsPerPosition, | 306 int scalarsPerPosition, |
302 const SkPoint& offset, | 307 const SkPoint& offset, |
303 const SkIRect& clipRect); | 308 const SkIRect& clipRect); |
304 | 309 |
305 void internalDrawBMPText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const SkPaint&, | 310 void internalDrawBMPText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const SkPaint&, |
306 GrColor color, const SkMatrix& viewMatrix, | 311 GrColor color, const SkMatrix& viewMatrix, |
(...skipping 25 matching lines...) Expand all Loading... | |
332 // sets up the descriptor on the blob and returns a detached cache. Client must attach | 337 // sets up the descriptor on the blob and returns a detached cache. Client must attach |
333 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); | 338 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); |
334 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa trix, bool noGamma); | 339 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa trix, bool noGamma); |
335 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY, | 340 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY, |
336 const BitmapTextBlob&, const SkPaint&, | 341 const BitmapTextBlob&, const SkPaint&, |
337 const SkMaskFilter::BlurRec&, | 342 const SkMaskFilter::BlurRec&, |
338 const SkMatrix& viewMatrix, SkScalar x , SkScalar y); | 343 const SkMatrix& viewMatrix, SkScalar x , SkScalar y); |
339 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor , | 344 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor , |
340 const SkMatrix& viewMatrix, | 345 const SkMatrix& viewMatrix, |
341 const SkTextBlob* blob, SkScalar x, SkScalar y, | 346 const SkTextBlob* blob, SkScalar x, SkScalar y, |
342 SkDrawFilter* drawFilter, const SkIRect& clipRect); | 347 SkDrawFilter* drawFilter, const SkIRect& clipRect, G rRenderTarget*, |
348 const GrClip&, const GrPaint&); | |
343 inline static bool HasLCD(const SkTextBlob*); | 349 inline static bool HasLCD(const SkTextBlob*); |
344 inline void initDistanceFieldPaint(SkPaint*, SkScalar* textRatio, const SkMa trix&); | 350 inline void initDistanceFieldPaint(SkPaint*, SkScalar* textRatio, const SkMa trix&); |
345 | 351 |
346 // Distance field text needs this table to compute a value for use in the fr agment shader. | 352 // Distance field text needs this table to compute a value for use in the fr agment shader. |
347 // Because the GrAtlasTextContext can go out of scope before the final flush , this needs to be | 353 // Because the GrAtlasTextContext can go out of scope before the final flush , this needs to be |
348 // refcnted and malloced | 354 // refcnted and malloced |
349 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> { | 355 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> { |
350 DistanceAdjustTable(float gamma) { this->buildDistanceAdjustTable(gamma) ; } | 356 DistanceAdjustTable(float gamma) { this->buildDistanceAdjustTable(gamma) ; } |
351 ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); } | 357 ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); } |
352 | 358 |
(...skipping 15 matching lines...) Expand all Loading... | |
368 bool fEnableDFRendering; | 374 bool fEnableDFRendering; |
369 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; | 375 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; |
370 | 376 |
371 friend class GrTextBlobCache; | 377 friend class GrTextBlobCache; |
372 friend class BitmapTextBatch; | 378 friend class BitmapTextBatch; |
373 | 379 |
374 typedef GrTextContext INHERITED; | 380 typedef GrTextContext INHERITED; |
375 }; | 381 }; |
376 | 382 |
377 #endif | 383 #endif |
OLD | NEW |