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 GrAtlasTextBlob_DEFINED | 8 #ifndef GrAtlasTextBlob_DEFINED |
9 #define GrAtlasTextBlob_DEFINED | 9 #define GrAtlasTextBlob_DEFINED |
10 | 10 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // We use this color vs the SkPaint color because it has the colorfilter app
lied. | 249 // We use this color vs the SkPaint color because it has the colorfilter app
lied. |
250 void initReusableBlob(GrColor color, const SkMatrix& viewMatrix, SkScalar x,
SkScalar y) { | 250 void initReusableBlob(GrColor color, const SkMatrix& viewMatrix, SkScalar x,
SkScalar y) { |
251 fPaintColor = color; | 251 fPaintColor = color; |
252 this->setupViewMatrix(viewMatrix, x, y); | 252 this->setupViewMatrix(viewMatrix, x, y); |
253 } | 253 } |
254 | 254 |
255 void initThrowawayBlob(const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { | 255 void initThrowawayBlob(const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { |
256 this->setupViewMatrix(viewMatrix, x, y); | 256 this->setupViewMatrix(viewMatrix, x, y); |
257 } | 257 } |
258 | 258 |
| 259 /** |
| 260 * Consecutive calls to regenInBatch often use the same SkGlyphCache. If the
same instance of |
| 261 * SkAutoGlyphCache is passed to multiple calls of regenInBatch then it can
save the cost of |
| 262 * multiple detach/attach operations of SkGlyphCache. |
| 263 */ |
259 void regenInBatch(GrDrawBatch::Target* target, GrBatchFontCache* fontCache, | 264 void regenInBatch(GrDrawBatch::Target* target, GrBatchFontCache* fontCache, |
260 GrBlobRegenHelper *helper, int run, int subRun, SkGlyphCac
he** cache, | 265 GrBlobRegenHelper *helper, int run, int subRun, SkAutoGlyp
hCache*, |
261 SkTypeface** typeface, const SkDescriptor** desc, size_t v
ertexStride, | 266 size_t vertexStride, const SkMatrix& viewMatrix, SkScalar
x, SkScalar y, |
262 const SkMatrix& viewMatrix, SkScalar x, SkScalar y, | 267 GrColor color, void** vertices, size_t* byteCount, int* gl
yphCount); |
263 GrColor color, | |
264 void** vertices, size_t* byteCount, int* glyphCount); | |
265 | 268 |
266 const Key& key() const { return fKey; } | 269 const Key& key() const { return fKey; } |
267 | 270 |
268 ~GrAtlasTextBlob() { | 271 ~GrAtlasTextBlob() { |
269 for (int i = 0; i < fRunCount; i++) { | 272 for (int i = 0; i < fRunCount; i++) { |
270 fRuns[i].~Run(); | 273 fRuns[i].~Run(); |
271 } | 274 } |
272 } | 275 } |
273 | 276 |
274 ////////////////////////////////////////////////////////////////////////////
//////////////////// | 277 ////////////////////////////////////////////////////////////////////////////
//////////////////// |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // will be used in place of the run's descriptor to regen texture coords | 485 // will be used in place of the run's descriptor to regen texture coords |
483 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties | 486 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties |
484 bool fInitialized; | 487 bool fInitialized; |
485 bool fDrawAsPaths; | 488 bool fDrawAsPaths; |
486 }; | 489 }; |
487 | 490 |
488 template <bool regenPos, bool regenCol, bool regenTexCoords, bool regenGlyph
s> | 491 template <bool regenPos, bool regenCol, bool regenTexCoords, bool regenGlyph
s> |
489 void regenInBatch(GrDrawBatch::Target* target, | 492 void regenInBatch(GrDrawBatch::Target* target, |
490 GrBatchFontCache* fontCache, | 493 GrBatchFontCache* fontCache, |
491 GrBlobRegenHelper* helper, | 494 GrBlobRegenHelper* helper, |
492 Run* run, Run::SubRunInfo* info, SkGlyphCache** cache, | 495 Run* run, Run::SubRunInfo* info, |
493 SkTypeface** typeface, const SkDescriptor** desc, | 496 SkAutoGlyphCache*, int glyphCount, |
494 int glyphCount, size_t vertexStride, | 497 size_t vertexStride, |
495 GrColor color, SkScalar transX, | 498 GrColor color, SkScalar transX, |
496 SkScalar transY) const; | 499 SkScalar transY) const; |
497 | 500 |
498 inline GrDrawBatch* createBatch(const Run::SubRunInfo& info, | 501 inline GrDrawBatch* createBatch(const Run::SubRunInfo& info, |
499 int glyphCount, int run, int subRun, | 502 int glyphCount, int run, int subRun, |
500 const SkMatrix& viewMatrix, SkScalar x, SkSc
alar y, | 503 const SkMatrix& viewMatrix, SkScalar x, SkSc
alar y, |
501 GrColor color, | 504 GrColor color, |
502 const SkPaint& skPaint, const SkSurfaceProps
& props, | 505 const SkPaint& skPaint, const SkSurfaceProps
& props, |
503 const GrDistanceFieldAdjustTable* distanceAd
justTable, | 506 const GrDistanceFieldAdjustTable* distanceAd
justTable, |
504 bool useGammaCorrectDistanceTable, | 507 bool useGammaCorrectDistanceTable, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 // We can reuse distance field text, but only if the new viewmatrix would no
t result in | 551 // We can reuse distance field text, but only if the new viewmatrix would no
t result in |
549 // a mip change. Because there can be multiple runs in a blob, we track the
overall | 552 // a mip change. Because there can be multiple runs in a blob, we track the
overall |
550 // maximum minimum scale, and minimum maximum scale, we can support before w
e need to regen | 553 // maximum minimum scale, and minimum maximum scale, we can support before w
e need to regen |
551 SkScalar fMaxMinScale; | 554 SkScalar fMaxMinScale; |
552 SkScalar fMinMaxScale; | 555 SkScalar fMinMaxScale; |
553 int fRunCount; | 556 int fRunCount; |
554 uint8_t fTextType; | 557 uint8_t fTextType; |
555 }; | 558 }; |
556 | 559 |
557 #endif | 560 #endif |
OLD | NEW |