| Index: src/gpu/text/GrAtlasTextBlob.h
|
| diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
|
| index 788eaba77bfb4ffffde2e84ddd994a5475acd4bf..fa3311e07c5ad0f56c5b6f127b77c9f7322cb974 100644
|
| --- a/src/gpu/text/GrAtlasTextBlob.h
|
| +++ b/src/gpu/text/GrAtlasTextBlob.h
|
| @@ -256,12 +256,17 @@ public:
|
| this->setupViewMatrix(viewMatrix, x, y);
|
| }
|
|
|
| + /**
|
| + * Consecutive calls to regenInBatch often use the same SkGlyphCache. If the same instance of
|
| + * this object is passed to multiple calls to regenInBatch then it can save the cost of multiple
|
| + * detach/attach operations of SkGlyphCache.
|
| + */
|
| + class LazyGlyphCache;
|
| +
|
| void regenInBatch(GrDrawBatch::Target* target, GrBatchFontCache* fontCache,
|
| - GrBlobRegenHelper *helper, int run, int subRun, SkGlyphCache** cache,
|
| - SkTypeface** typeface, const SkDescriptor** desc, size_t vertexStride,
|
| - const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
|
| - GrColor color,
|
| - void** vertices, size_t* byteCount, int* glyphCount);
|
| + GrBlobRegenHelper *helper, int run, int subRun, LazyGlyphCache*,
|
| + size_t vertexStride, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
|
| + GrColor color, void** vertices, size_t* byteCount, int* glyphCount);
|
|
|
| const Key& key() const { return fKey; }
|
|
|
| @@ -489,9 +494,9 @@ private:
|
| void regenInBatch(GrDrawBatch::Target* target,
|
| GrBatchFontCache* fontCache,
|
| GrBlobRegenHelper* helper,
|
| - Run* run, Run::SubRunInfo* info, SkGlyphCache** cache,
|
| - SkTypeface** typeface, const SkDescriptor** desc,
|
| - int glyphCount, size_t vertexStride,
|
| + Run* run, Run::SubRunInfo* info,
|
| + LazyGlyphCache*, int glyphCount,
|
| + size_t vertexStride,
|
| GrColor color, SkScalar transX,
|
| SkScalar transY) const;
|
|
|
| @@ -554,4 +559,14 @@ private:
|
| uint8_t fTextType;
|
| };
|
|
|
| +class GrAtlasTextBlob::LazyGlyphCache {
|
| +public:
|
| + SkGlyphCache* cache() const { return fCache.get(); }
|
| +
|
| + void initIfNecessary(Run*, Run::SubRunInfo*);
|
| +private:
|
| + SkAutoGlyphCache fCache;
|
| + const SkTypeface* fTypeface = nullptr;
|
| +};
|
| +
|
| #endif
|
|
|