Update GrOp subclasses to use onDumpInfo for info dumping.

This is meant to parallel the changes in http://review.skia.org/309793,
but for GrOps. The base-class info is automatically appended without
subclasses manually calling `append(INHERITED::dumpInfo())`.

Change-Id: Ic815305feeeca07385687af5703f0dd88a008f9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309879
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2020-08-12 19:06:24 -04:00 committed by Skia Commit-Bot
parent 1e0136ecdb
commit 8dd1e22f41
24 changed files with 58 additions and 113 deletions

View File

@ -725,12 +725,8 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.appendf("Count: %d\n", fPaths.count());
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
SkString onDumpInfo() const override {
return SkStringPrintf("Count: %d\n%s", fPaths.count(), fHelper.dumpInfo().c_str());
}
#endif

View File

@ -857,13 +857,10 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.appendf("Color: 0x%08x Coverage: 0x%02x, Count: %d\n", fColor.toBytes_RGBA(),
fCoverage, fPaths.count());
string += INHERITED::dumpInfo();
string += fHelper.dumpInfo();
return string;
SkString onDumpInfo() const override {
return SkStringPrintf("Color: 0x%08x Coverage: 0x%02x, Count: %d\n%s",
fColor.toBytes_RGBA(), fCoverage, fPaths.count(),
fHelper.dumpInfo().c_str());
}
#endif

View File

@ -187,7 +187,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (const auto& path : fPaths) {
string.appendf(
@ -197,7 +197,6 @@ public:
path.fMiterLimit);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif

View File

@ -93,7 +93,7 @@ void GrAtlasTextOp::visitProxies(const VisitProxyFunc& func) const {
}
#if GR_TEST_UTILS
SkString GrAtlasTextOp::dumpInfo() const {
SkString GrAtlasTextOp::onDumpInfo() const {
SkString str;
for (int i = 0; i < fGeoCount; ++i) {
@ -105,7 +105,6 @@ SkString GrAtlasTextOp::dumpInfo() const {
}
str += fProcessors.dumpProcessors();
str += INHERITED::dumpInfo();
return str;
}
#endif

View File

@ -44,7 +44,7 @@ public:
void visitProxies(const VisitProxyFunc& func) const override;
#if GR_TEST_UTILS
SkString dumpInfo() const override;
SkString onDumpInfo() const override;
#endif
FixedFunctionFlags fixedFunctionFlags() const override;

View File

@ -31,10 +31,8 @@ public:
const char* name() const override { return "Clear"; }
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.append(INHERITED::dumpInfo());
string.appendf("Scissor [ ");
SkString onDumpInfo() const override {
SkString string("Scissor [ ");
if (fScissor.enabled()) {
const SkIRect& r = fScissor.rect();
string.appendf("L: %d, T: %d, R: %d, B: %d", r.fLeft, r.fTop, r.fRight, r.fBottom);

View File

@ -245,7 +245,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (const auto& geo : fLines) {
string.appendf("Pt0: [%.2f, %.2f], Pt1: [%.2f, %.2f], Width: %.2f, Ival0: %.2f, "
@ -258,7 +258,6 @@ public:
geo.fPhase);
}
string += fProcessorSet.dumpProcessors();
string += INHERITED::dumpInfo();
return string;
}
#endif

View File

@ -370,14 +370,13 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.appendf("Color: 0x%08x Count: %d\n", fColor.toBytes_RGBA(), fPaths.count());
SkString onDumpInfo() const override {
SkString string = SkStringPrintf("Color: 0x%08x Count: %d\n",
fColor.toBytes_RGBA(), fPaths.count());
for (const auto& path : fPaths) {
string.appendf("Tolerance: %.2f\n", path.fTolerance);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif

View File

@ -45,7 +45,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override;
SkString onDumpInfo() const override;
#endif
FixedFunctionFlags fixedFunctionFlags() const override;
@ -187,14 +187,13 @@ DrawAtlasOp::DrawAtlasOp(const Helper::MakeArgs& helperArgs, const SkPMColor4f&
}
#if GR_TEST_UTILS
SkString DrawAtlasOp::dumpInfo() const {
SkString DrawAtlasOp::onDumpInfo() const {
SkString string;
for (const auto& geo : fGeoData) {
string.appendf("Color: 0x%08x, Quads: %d\n", geo.fColor.toBytes_RGBA(),
geo.fVerts.count() / 4);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif

View File

@ -38,11 +38,8 @@ GrDrawPathOpBase::GrDrawPathOpBase(uint32_t classID, const SkMatrix& viewMatrix,
, fProcessorSet(std::move(paint)) {}
#if GR_TEST_UTILS
SkString GrDrawPathOp::dumpInfo() const {
SkString string;
string.printf("PATH: 0x%p", fPath.get());
string.append(INHERITED::dumpInfo());
return string;
SkString GrDrawPathOp::onDumpInfo() const {
return SkStringPrintf("PATH: 0x%p", fPath.get());
}
#endif

View File

@ -81,7 +81,7 @@ public:
const char* name() const override { return "DrawPath"; }
#if GR_TEST_UTILS
SkString dumpInfo() const override;
SkString onDumpInfo() const override;
#endif
private:

View File

@ -456,7 +456,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override;
SkString onDumpInfo() const override;
#endif
FixedFunctionFlags fixedFunctionFlags() const override;
@ -582,13 +582,10 @@ DrawVerticesOp::DrawVerticesOp(const Helper::MakeArgs& helperArgs,
}
#if GR_TEST_UTILS
SkString DrawVerticesOp::dumpInfo() const {
SkString string;
string.appendf("PrimType: %d, MeshCount %d, VCount: %d, ICount: %d\n", (int)fPrimitiveType,
fMeshes.count(), fVertexCount, fIndexCount);
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
SkString DrawVerticesOp::onDumpInfo() const {
return SkStringPrintf("PrimType: %d, MeshCount %d, VCount: %d, ICount: %d\n%s",
(int)fPrimitiveType, fMeshes.count(), fVertexCount, fIndexCount,
fHelper.dumpInfo().c_str());
}
#endif

View File

@ -26,12 +26,6 @@ public:
const char* name() const override { return "Drawable"; }
#if GR_TEST_UTILS
SkString dumpInfo() const override {
return INHERITED::dumpInfo();
}
#endif
private:
friend class GrOpMemoryPool; // for ctor

View File

@ -121,9 +121,8 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString str;
str.appendf("# draws: %u\n", fQuads.count());
SkString onDumpInfo() const override {
SkString str = SkStringPrintf("# draws: %u\n", fQuads.count());
str.appendf("Device quad type: %u, local quad type: %u\n",
(uint32_t) fQuads.deviceQuadType(), (uint32_t) fQuads.localQuadType());
str += fHelper.dumpInfo();
@ -135,7 +134,6 @@ public:
info.fColor, info.fAAFlags);
i++;
}
str += INHERITED::dumpInfo();
return str;
}
#endif

View File

@ -174,7 +174,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString str;
for (int i = 0; i < fPatches.count(); ++i) {
@ -184,7 +184,6 @@ public:
}
str += fHelper.dumpInfo();
str += INHERITED::dumpInfo();
return str;
}
#endif

View File

@ -181,11 +181,11 @@ public:
/** Used for spewing information about ops when debugging. */
#if GR_TEST_UTILS
virtual SkString dumpInfo() const {
SkString string;
string.appendf("OpBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
fBounds.fLeft, fBounds.fTop, fBounds.fRight, fBounds.fBottom);
return string;
virtual SkString onDumpInfo() const { return SkString(); }
virtual SkString dumpInfo() const final {
return SkStringPrintf("%s\nOpBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]",
this->onDumpInfo().c_str(), fBounds.fLeft, fBounds.fTop,
fBounds.fRight, fBounds.fBottom);
}
#endif

View File

@ -1227,7 +1227,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (int i = 0; i < fCircles.count(); ++i) {
string.appendf(
@ -1239,7 +1239,6 @@ public:
fCircles[i].fOuterRadius);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif
@ -1589,7 +1588,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (int i = 0; i < fCircles.count(); ++i) {
string.appendf(
@ -1603,7 +1602,6 @@ public:
fCircles[i].fPhaseAngle);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif
@ -1920,9 +1918,8 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.appendf("Stroked: %d\n", fStroked);
SkString onDumpInfo() const override {
SkString string = SkStringPrintf("Stroked: %d\n", fStroked);
for (const auto& geo : fEllipses) {
string.appendf(
"Color: 0x%08x Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], "
@ -1932,7 +1929,6 @@ public:
geo.fInnerXRadius, geo.fInnerYRadius);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif
@ -2197,7 +2193,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (const auto& geo : fEllipses) {
string.appendf(
@ -2209,7 +2205,6 @@ public:
geo.fInnerXRadius, geo.fInnerYRadius, geo.fGeoDx, geo.fGeoDy);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif
@ -2547,7 +2542,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (int i = 0; i < fRRects.count(); ++i) {
string.appendf(
@ -2559,7 +2554,6 @@ public:
fRRects[i].fOuterRadius);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif
@ -2919,9 +2913,8 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.appendf("Stroked: %d\n", fStroked);
SkString onDumpInfo() const override {
SkString string = SkStringPrintf("Stroked: %d\n", fStroked);
for (const auto& geo : fRRects) {
string.appendf(
"Color: 0x%08x Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], "
@ -2931,7 +2924,6 @@ public:
geo.fInnerXRadius, geo.fInnerYRadius);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif

View File

@ -73,16 +73,14 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString str;
str.appendf("# combined: %d\n", fRegions.count());
SkString onDumpInfo() const override {
SkString str = SkStringPrintf("# combined: %d\n", fRegions.count());
for (int i = 0; i < fRegions.count(); ++i) {
const RegionInfo& info = fRegions[i];
str.appendf("%d: Color: 0x%08x, Region with %d rects\n", i, info.fColor.toBytes_RGBA(),
info.fRegion.computeRegionComplexity());
}
str += fHelper.dumpInfo();
str += INHERITED::dumpInfo();
return str;
}
#endif

View File

@ -240,7 +240,7 @@ public:
const char* name() const override { return "ShadowCircularRRectOp"; }
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (int i = 0; i < fGeoData.count(); ++i) {
string.appendf(
@ -251,7 +251,6 @@ public:
fGeoData[i].fOuterRadius, fGeoData[i].fUmbraInset,
fGeoData[i].fInnerRadius, fGeoData[i].fBlurRadius);
}
string.append(INHERITED::dumpInfo());
return string;
}
#endif

View File

@ -137,13 +137,12 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (const auto& geo : fShapes) {
string.appendf("Color: 0x%08x\n", geo.fColor.toBytes_RGBA());
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif

View File

@ -31,11 +31,8 @@ public:
const char* name() const override { return "StencilPathOp"; }
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.printf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
string.append(INHERITED::dumpInfo());
return string;
SkString onDumpInfo() const override {
return SkStringPrintf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
}
#endif

View File

@ -100,16 +100,11 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.appendf(
"Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], "
"StrokeWidth: %.2f\n",
fColor.toBytes_RGBA(), fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom,
fStrokeWidth);
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
SkString onDumpInfo() const override {
return SkStringPrintf("Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], "
"StrokeWidth: %.2f\n%s",
fColor.toBytes_RGBA(), fRect.fLeft, fRect.fTop, fRect.fRight,
fRect.fBottom, fStrokeWidth, fHelper.dumpInfo().c_str());
}
#endif
@ -429,7 +424,7 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString onDumpInfo() const override {
SkString string;
for (const auto& info : fRects) {
string.appendf(
@ -443,7 +438,6 @@ public:
info.fDevInside.fRight, info.fDevInside.fBottom, info.fDegenerate);
}
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}
#endif

View File

@ -277,9 +277,8 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString str;
str.appendf("# draws: %d\n", fQuads.count());
SkString onDumpInfo() const override {
SkString str = SkStringPrintf("# draws: %d\n", fQuads.count());
auto iter = fQuads.iterator();
for (unsigned p = 0; p < fMetadata.fProxyCount; ++p) {
str.appendf("Proxy ID: %d, Filter: %d, MM: %d\n",
@ -305,7 +304,6 @@ public:
i++;
}
}
str += INHERITED::dumpInfo();
return str;
}
#endif

View File

@ -191,12 +191,9 @@ public:
}
#if GR_TEST_UTILS
SkString dumpInfo() const override {
SkString string;
string.appendf("Color 0x%08x, aa: %d\n", fColor.toBytes_RGBA(), fAntiAlias);
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
SkString onDumpInfo() const override {
return SkStringPrintf("Color 0x%08x, aa: %d\n%s",
fColor.toBytes_RGBA(), fAntiAlias, fHelper.dumpInfo().c_str());
}
#endif