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

Unified Diff: src/gpu/GrAtlasTextContext.cpp

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/GrAtlasTextBlob.cpp ('k') | src/gpu/GrTextBlobCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 8009e92f934ccf5e0da824a4e381241152c9ac6a..0e901ae40cdab18f5f8896a807343ed8562cdc7a 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -410,10 +410,25 @@ void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt,
} else {
// If we can reuse the blob, then make sure we update the blob's viewmatrix, and x/y
// offsets
+ // TODO bounds are wrong
cacheBlob->fViewMatrix = viewMatrix;
cacheBlob->fX = x;
cacheBlob->fY = y;
fCache->makeMRU(cacheBlob);
+#ifdef CACHE_SANITY_CHECK
+ {
+ int glyphCount = 0;
+ int runCount = 0;
+ GrTextBlobCache::BlobGlyphCount(&glyphCount, &runCount, blob);
+ SkAutoTUnref<GrAtlasTextBlob> sanityBlob(fCache->createBlob(glyphCount, runCount,
+ kGrayTextVASize));
+ GrTextBlobCache::SetupCacheBlobKey(sanityBlob, key, blurRec, skPaint);
+ this->regenerateTextBlob(sanityBlob, skPaint, grPaint.getColor(), viewMatrix,
+ blob, x, y, drawFilter, clipRect, rt, clip, grPaint);
+ GrAtlasTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
+ }
+
+#endif
}
} else {
if (canCache) {
@@ -426,7 +441,6 @@ void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt,
blob, x, y, drawFilter, clipRect, rt, clip, grPaint);
}
- cacheBlob->fPaintColor = skPaint.getColor();
this->flush(blob, cacheBlob, rt, skPaint, grPaint, drawFilter,
clip, viewMatrix, clipBounds, x, y, transX, transY);
}
@@ -477,6 +491,7 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob,
SkDrawFilter* drawFilter, const SkIRect& clipRect,
GrRenderTarget* rt, const GrClip& clip,
const GrPaint& paint) {
+ cacheBlob->fPaintColor = skPaint.getColor();
cacheBlob->fViewMatrix = viewMatrix;
cacheBlob->fX = x;
cacheBlob->fY = y;
« no previous file with comments | « src/gpu/GrAtlasTextBlob.cpp ('k') | src/gpu/GrTextBlobCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698