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

Side by Side Diff: src/gpu/text/GrAtlasTextContext.cpp

Issue 1684513004: cleanup textblob cache sanity check and prevent it from bitrotting (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.cpp ('k') | src/gpu/text/GrTextBlobCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "GrAtlasTextContext.h" 7 #include "GrAtlasTextContext.h"
8 8
9 #include "GrDrawContext.h" 9 #include "GrDrawContext.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // We have to remake the blob because changes may invalidate our mas ks. 149 // We have to remake the blob because changes may invalidate our mas ks.
150 // TODO we could probably get away reuse most of the time if the poi nter is unique, 150 // TODO we could probably get away reuse most of the time if the poi nter is unique,
151 // but we'd have to clear the subrun information 151 // but we'd have to clear the subrun information
152 fCache->remove(cacheBlob); 152 fCache->remove(cacheBlob);
153 cacheBlob.reset(SkRef(fCache->createCachedBlob(blob, key, blurRec, s kPaint, 153 cacheBlob.reset(SkRef(fCache->createCachedBlob(blob, key, blurRec, s kPaint,
154 GrAtlasTextBlob::kGra yTextVASize))); 154 GrAtlasTextBlob::kGra yTextVASize)));
155 this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), vie wMatrix, 155 this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), vie wMatrix,
156 blob, x, y, drawFilter); 156 blob, x, y, drawFilter);
157 } else { 157 } else {
158 fCache->makeMRU(cacheBlob); 158 fCache->makeMRU(cacheBlob);
159 #ifdef CACHE_SANITY_CHECK 159
160 { 160 if (CACHE_SANITY_CHECK) {
161 int glyphCount = 0; 161 int glyphCount = 0;
162 int runCount = 0; 162 int runCount = 0;
163 GrTextBlobCache::BlobGlyphCount(&glyphCount, &runCount, blob); 163 GrTextBlobCache::BlobGlyphCount(&glyphCount, &runCount, blob);
164 SkAutoTUnref<GrAtlasTextBlob> sanityBlob(fCache->createBlob(glyp hCount, runCount, 164 SkAutoTUnref<GrAtlasTextBlob> sanityBlob(
165 kGra yTextVASize)); 165 fCache->createBlob(glyphCount, runCount, GrAtlasTextBlob::kG rayTextVASize));
166 GrTextBlobCache::SetupCacheBlobKey(sanityBlob, key, blurRec, skP aint); 166 GrTextBlobCache::SetupCacheBlobKey(sanityBlob, key, blurRec, skP aint);
167 this->regenerateTextBlob(sanityBlob, skPaint, grPaint.getColor() , viewMatrix, 167 this->regenerateTextBlob(sanityBlob, skPaint, grPaint.getColor() , viewMatrix,
168 blob, x, y, drawFilter); 168 blob, x, y, drawFilter);
169 GrAtlasTextBlob::AssertEqual(*sanityBlob, *cacheBlob); 169 GrAtlasTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
170 } 170 }
171
172 #endif
173 } 171 }
174 } else { 172 } else {
175 if (canCache) { 173 if (canCache) {
176 cacheBlob.reset(SkRef(fCache->createCachedBlob(blob, key, blurRec, s kPaint, 174 cacheBlob.reset(SkRef(fCache->createCachedBlob(blob, key, blurRec, s kPaint,
177 GrAtlasTextBlob::kGra yTextVASize))); 175 GrAtlasTextBlob::kGra yTextVASize)));
178 } else { 176 } else {
179 cacheBlob.reset(fCache->createBlob(blob, GrAtlasTextBlob::kGrayTextV ASize)); 177 cacheBlob.reset(fCache->createBlob(blob, GrAtlasTextBlob::kGrayTextV ASize));
180 } 178 }
181 this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), viewMat rix, 179 this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), viewMat rix,
182 blob, x, y, drawFilter); 180 blob, x, y, drawFilter);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // We'd like to be able to test this with random translations, but currently the vertex 394 // We'd like to be able to test this with random translations, but currently the vertex
397 // bounds and vertices will get out of sync 395 // bounds and vertices will get out of sync
398 SkScalar transX = 0.f;//SkIntToScalar(random->nextU()); 396 SkScalar transX = 0.f;//SkIntToScalar(random->nextU());
399 SkScalar transY = 0.f;//SkIntToScalar(random->nextU()); 397 SkScalar transY = 0.f;//SkIntToScalar(random->nextU());
400 return blob->test_createBatch(textLen, 0, 0, color, transX, transY, skPaint, 398 return blob->test_createBatch(textLen, 0, 0, color, transX, transY, skPaint,
401 gSurfaceProps, gTextContext->dfAdjustTable(), 399 gSurfaceProps, gTextContext->dfAdjustTable(),
402 context->getBatchFontCache()); 400 context->getBatchFontCache());
403 } 401 }
404 402
405 #endif 403 #endif
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.cpp ('k') | src/gpu/text/GrTextBlobCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698