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

Unified Diff: src/gpu/GrAtlasTextBlob.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.h ('k') | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextBlob.cpp
diff --git a/src/gpu/GrAtlasTextBlob.cpp b/src/gpu/GrAtlasTextBlob.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d357145cbcffa5088da2e1e7f3bcf8af72e5511b
--- /dev/null
+++ b/src/gpu/GrAtlasTextBlob.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrAtlasTextBlob.h"
+
+#ifdef CACHE_SANITY_CHECK
+void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlob& r) {
+ SkASSERT(l.fSize == r.fSize);
+ SkASSERT(l.fPool == r.fPool);
+
+ SkASSERT(l.fBlurRec.fSigma == r.fBlurRec.fSigma);
+ SkASSERT(l.fBlurRec.fStyle == r.fBlurRec.fStyle);
+ SkASSERT(l.fBlurRec.fQuality == r.fBlurRec.fQuality);
+
+ SkASSERT(l.fStrokeInfo.fFrameWidth == r.fStrokeInfo.fFrameWidth);
+ SkASSERT(l.fStrokeInfo.fMiterLimit == r.fStrokeInfo.fMiterLimit);
+ SkASSERT(l.fStrokeInfo.fJoin == r.fStrokeInfo.fJoin);
+
+ SkASSERT(l.fBigGlyphs.count() == r.fBigGlyphs.count());
+ for (int i = 0; i < l.fBigGlyphs.count(); i++) {
+ const BigGlyph& lBigGlyph = l.fBigGlyphs[i];
+ const BigGlyph& rBigGlyph = r.fBigGlyphs[i];
+
+ SkASSERT(lBigGlyph.fPath == rBigGlyph.fPath);
+ // We can't assert that these have the same translations
+ }
+
+ SkASSERT(l.fKey == r.fKey);
+ SkASSERT(l.fViewMatrix.cheapEqualTo(r.fViewMatrix));
+ SkASSERT(l.fPaintColor == r.fPaintColor);
+ SkASSERT(l.fMaxMinScale == r.fMaxMinScale);
+ SkASSERT(l.fMinMaxScale == r.fMinMaxScale);
+ SkASSERT(l.fTextType == r.fTextType);
+
+ SkASSERT(l.fRunCount == r.fRunCount);
+ for (int i = 0; i < l.fRunCount; i++) {
+ const Run& lRun = l.fRuns[i];
+ const Run& rRun = r.fRuns[i];
+
+ if (lRun.fStrike.get()) {
+ SkASSERT(rRun.fStrike.get());
+ SkASSERT(GrBatchTextStrike::GetKey(*lRun.fStrike) ==
+ GrBatchTextStrike::GetKey(*rRun.fStrike));
+
+ } else {
+ SkASSERT(!rRun.fStrike.get());
+ }
+
+ if (lRun.fTypeface.get()) {
+ SkASSERT(rRun.fTypeface.get());
+ SkASSERT(SkTypeface::Equal(lRun.fTypeface, rRun.fTypeface));
+ } else {
+ SkASSERT(!rRun.fTypeface.get());
+ }
+
+ // TODO BOUNDS ARE ALL MESSED UP
+ //SkASSERT(lRun.fVertexBounds == rRun.fVertexBounds);
+
+ SkASSERT(lRun.fDescriptor.getDesc());
+ SkASSERT(rRun.fDescriptor.getDesc());
+ SkASSERT(lRun.fDescriptor.getDesc()->equals(*rRun.fDescriptor.getDesc()));
+
+ if (lRun.fOverrideDescriptor.get()) {
+ SkASSERT(lRun.fOverrideDescriptor->getDesc());
+ SkASSERT(rRun.fOverrideDescriptor.get() && rRun.fOverrideDescriptor->getDesc());;
+ SkASSERT(lRun.fOverrideDescriptor->getDesc()->equals(
+ *rRun.fOverrideDescriptor->getDesc()));
+ } else {
+ SkASSERT(!rRun.fOverrideDescriptor.get());
+ }
+
+ // color can be changed
+ //SkASSERT(lRun.fColor == rRun.fColor);
+ SkASSERT(lRun.fInitialized == rRun.fInitialized);
+ SkASSERT(lRun.fDrawAsPaths == rRun.fDrawAsPaths);
+
+ SkASSERT(lRun.fSubRunInfo.count() == rRun.fSubRunInfo.count());
+ for(int j = 0; j < lRun.fSubRunInfo.count(); j++) {
+ const Run::SubRunInfo& lSubRun = lRun.fSubRunInfo[j];
+ const Run::SubRunInfo& rSubRun = rRun.fSubRunInfo[j];
+
+ SkASSERT(lSubRun.fVertexStartIndex == rSubRun.fVertexStartIndex);
+ SkASSERT(lSubRun.fVertexEndIndex == rSubRun.fVertexEndIndex);
+ SkASSERT(lSubRun.fGlyphStartIndex == rSubRun.fGlyphStartIndex);
+ SkASSERT(lSubRun.fGlyphEndIndex == rSubRun.fGlyphEndIndex);
+ SkASSERT(lSubRun.fTextRatio == rSubRun.fTextRatio);
+ SkASSERT(lSubRun.fMaskFormat == rSubRun.fMaskFormat);
+ SkASSERT(lSubRun.fDrawAsDistanceFields == rSubRun.fDrawAsDistanceFields);
+ SkASSERT(lSubRun.fUseLCDText == rSubRun.fUseLCDText);
+
+ //We can't compare the bulk use tokens with this method
+ /*
+ SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate.count() ==
+ rSubRun.fBulkUseToken.fPlotsToUpdate.count());
+ SkASSERT(lSubRun.fBulkUseToken.fPlotAlreadyUpdated ==
+ rSubRun.fBulkUseToken.fPlotAlreadyUpdated);
+ for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k++) {
+ SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] ==
+ rSubRun.fBulkUseToken.fPlotsToUpdate[k]);
+ }*/
+ }
+ }
+}
+
+#endif
« no previous file with comments | « src/gpu/GrAtlasTextBlob.h ('k') | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698