Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: src/gpu/text/GrAtlasTextBlob.h

Issue 1983353003: Attempt to improve lifetime management of SkGlyphCache in Ganesh atlas text code. (Closed) Base URL: https://skia.googlesource.com/skia.git@fixtest
Patch Set: default Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
bungeman-skia 2016/05/18 15:33:07 nit: why two spaces between '=' and 'nullptr'?
+};
+
#endif

Powered by Google App Engine
This is Rietveld 408576698