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

Unified Diff: src/gpu/GrTextBlobCache.h

Issue 1250693002: Add sanity check to GrAtlasTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@debug
Patch Set: more Created 5 years, 5 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
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/GrTextBlobCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextBlobCache.h
diff --git a/src/gpu/GrTextBlobCache.h b/src/gpu/GrTextBlobCache.h
index ca12411f7d3c0b2112a68342e8361405408d93f1..4c9cb14000e7c1642177bea8b185bc37898e4ac7 100644
--- a/src/gpu/GrTextBlobCache.h
+++ b/src/gpu/GrTextBlobCache.h
@@ -38,15 +38,10 @@ public:
return cacheBlob;
}
- GrAtlasTextBlob* createCachedBlob(const SkTextBlob* blob,
- const GrAtlasTextBlob::Key& key,
- const SkMaskFilter::BlurRec& blurRec,
- const SkPaint& paint,
- size_t maxVAStride) {
- int glyphCount = 0;
- int runCount = 0;
- BlobGlyphCount(&glyphCount, &runCount, blob);
- GrAtlasTextBlob* cacheBlob = this->createBlob(glyphCount, runCount, maxVAStride);
+ static void SetupCacheBlobKey(GrAtlasTextBlob* cacheBlob,
+ const GrAtlasTextBlob::Key& key,
+ const SkMaskFilter::BlurRec& blurRec,
+ const SkPaint& paint) {
cacheBlob->fKey = key;
if (key.fHasBlur) {
cacheBlob->fBlurRec = blurRec;
@@ -56,6 +51,18 @@ public:
cacheBlob->fStrokeInfo.fMiterLimit = paint.getStrokeMiter();
cacheBlob->fStrokeInfo.fJoin = paint.getStrokeJoin();
}
+ }
+
+ GrAtlasTextBlob* createCachedBlob(const SkTextBlob* blob,
+ const GrAtlasTextBlob::Key& key,
+ const SkMaskFilter::BlurRec& blurRec,
+ const SkPaint& paint,
+ size_t maxVAStride) {
+ int glyphCount = 0;
+ int runCount = 0;
+ BlobGlyphCount(&glyphCount, &runCount, blob);
+ GrAtlasTextBlob* cacheBlob = this->createBlob(glyphCount, runCount, maxVAStride);
+ SetupCacheBlobKey(cacheBlob, key, blurRec, paint);
this->add(cacheBlob);
return cacheBlob;
}
@@ -115,15 +122,15 @@ public:
void freeAll();
-private:
// TODO move to SkTextBlob
- void BlobGlyphCount(int* glyphCount, int* runCount, const SkTextBlob* blob) {
+ static void BlobGlyphCount(int* glyphCount, int* runCount, const SkTextBlob* blob) {
SkTextBlob::RunIterator itCounter(blob);
for (; !itCounter.done(); itCounter.next(), (*runCount)++) {
*glyphCount += itCounter.glyphCount();
}
}
+private:
typedef SkTInternalLList<GrAtlasTextBlob> BitmapBlobList;
// Budget was chosen to be ~4 megabytes. The min alloc and pre alloc sizes in the pool are
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/GrTextBlobCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698