Reduce verbosity of SkGraphics::Init in default case.
authorhalcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 10 Jan 2014 15:00:45 +0000 (15:00 +0000)
committerhalcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 10 Jan 2014 15:00:45 +0000 (15:00 +0000)
SkGraphics::Init() now checks to see if there are any non-default
runtime configuration options before announcing that it is about
to print out the non-default runtime configuration options.

This makes the executables in tools/ less verbose.

Add SkRTConfRegistry::countNonDefault() function.

BUG=
R=mtklein@google.com, reed@google.com

Review URL: https://codereview.chromium.org/133583003

git-svn-id: http://skia.googlecode.com/svn/trunk@13017 2bbb7eff-a529-9590-31e7-b0007b416f81

include/utils/SkRTConf.h
src/core/SkGraphics.cpp
src/utils/SkRTConf.cpp

index 4d7cda2..37e3259 100644 (file)
@@ -75,6 +75,7 @@ class SkRTConfRegistry {
 public:
     SkRTConfRegistry();
     void printAll(const char *fname = NULL) const;
+    bool hasNonDefault() const;
     void printNonDefault(const char *fname = NULL) const;
     const char *configFileLocation() const;
     void possiblyDumpFile() const;
index 51521e4..634b895 100644 (file)
@@ -55,8 +55,10 @@ void SkGraphics::Init() {
 #ifdef SK_DEVELOPER
     skRTConfRegistry().possiblyDumpFile();
     skRTConfRegistry().validate();
-    SkDebugf("Non-default runtime configuration options:\n");
-    skRTConfRegistry().printNonDefault( );
+    if (skRTConfRegistry().hasNonDefault()) {
+        SkDebugf("Non-default runtime configuration options:\n");
+        skRTConfRegistry().printNonDefault();
+    }
 #endif
 
 #ifdef BUILD_EMBOSS_TABLE
index 895cfa5..b871374 100644 (file)
@@ -105,6 +105,17 @@ void SkRTConfRegistry::printAll(const char *fname) const {
     delete o;
 }
 
+bool SkRTConfRegistry::hasNonDefault() const {
+    ConfMap::Iter iter(fConfs);
+    SkTDArray<SkRTConfBase *> *confArray;
+    while (iter.next(&confArray)) {
+        if (!confArray->getAt(0)->isDefault()) {
+            return true;
+        }
+    }
+    return false;
+}
+
 void SkRTConfRegistry::printNonDefault(const char *fname) const {
     SkWStream *o;