Avoid printing draw target info to stderr while running unit tests
Change draw target dump function to return a SkString. Clients can do
whatever they want with the string.
BUG=skia:1837
R=caryclark@google.com, bsalomon@google.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/72353003
git-svn-id: http://skia.googlecode.com/svn/trunk@12340 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 9397d14..6a1c454 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1008,23 +1008,24 @@
return *this;
}
-void GrDrawTargetCaps::print() const {
+SkString GrDrawTargetCaps::dump() const {
+ SkString r;
static const char* gNY[] = {"NO", "YES"};
- GrPrintf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]);
- GrPrintf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]);
- GrPrintf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
- GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
- GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]);
- GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]);
- GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
- GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSupport]);
- GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
- GrPrintf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]);
- GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]);
- GrPrintf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]);
- GrPrintf("Max Texture Size : %d\n", fMaxTextureSize);
- GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
- GrPrintf("Max Sample Count : %d\n", fMaxSampleCount);
+ r.appendf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]);
+ r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]);
+ r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
+ r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
+ r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]);
+ r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]);
+ r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
+ r.appendf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSupport]);
+ r.appendf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
+ r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]);
+ r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]);
+ r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]);
+ r.appendf("Max Texture Size : %d\n", fMaxTextureSize);
+ r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
+ r.appendf("Max Sample Count : %d\n", fMaxSampleCount);
static const char* kConfigNames[] = {
"Unknown", // kUnknown_GrPixelConfig
@@ -1048,10 +1049,11 @@
SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][1]);
for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
if (i != kUnknown_GrPixelConfig) {
- GrPrintf("%s is renderable: %s, with MSAA: %s\n",
+ r.appendf("%s is renderable: %s, with MSAA: %s\n",
kConfigNames[i],
gNY[fConfigRenderSupport[i][0]],
gNY[fConfigRenderSupport[i][1]]);
}
}
+ return r;
}