Clean up SkTypes.h.
authorbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 11 Oct 2013 18:50:45 +0000 (18:50 +0000)
committerbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 11 Oct 2013 18:50:45 +0000 (18:50 +0000)
This change removes sk_stdint.h since it is only needed for vs2008 and earlier.
This change removes SK_MMAP_SUPPORT define since it is no longer used.
This change removes the stdio.h include from SkTypes.h since on many systems
this is a very large header, few Skia files actually use it, it is
available everywhere standard, and SkDebugf should be used instead.

After this change there is no need for external users to put Skia's
include/config into their own list of includes, saving the headache
of having two header files of the same name and sometimes getting the
wrong one depending on include order.

R=bsalomon@google.com, djsollen@google.com

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

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

21 files changed:
bench/SkBenchLogger.h
gyp/common_conditions.gypi
include/config/sk_stdint.h [deleted file]
include/core/SkPreConfig.h
include/core/SkStream.h
include/core/SkTypes.h
samplecode/SampleDegenerateTwoPtRadials.cpp
samplecode/SampleEmptyPath.cpp
samplecode/SamplePath.cpp
src/gpu/GrSurface.cpp
src/gpu/gl/GrGLUtil.cpp
src/pathops/SkPathOpsDebug.h
src/utils/SkDumpCanvas.cpp
tests/ClipCubicTest.cpp
tests/FontNamesTest.cpp
tests/MathTest.cpp
tests/Matrix44Test.cpp
tests/MatrixTest.cpp
tests/PathOpsQuadReduceOrderTest.cpp
tests/StringTest.cpp
tests/WArrayTest.cpp

index 21d64e4..77a0837 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "SkTypes.h"
 #include "SkString.h"
+#include <stdio.h>
 
 class SkFILEWStream;
 
index 8fce3ca..d6154ca 100644 (file)
@@ -32,7 +32,6 @@
         'defines': [
           'SK_BUILD_FOR_WIN32',
           'SK_FONTHOST_USES_FONTMGR',
-          'SK_IGNORE_STDINT_DOT_H',
           '_CRT_SECURE_NO_WARNINGS',
           'GR_GL_FUNCTION_TYPE=__stdcall',
         ],
diff --git a/include/config/sk_stdint.h b/include/config/sk_stdint.h
deleted file mode 100644 (file)
index 360755e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#ifndef sk_stdint_DEFINED
-#define sk_stdint_DEFINED
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned uint32_t;
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-
-typedef int64_t intmax_t;
-typedef uint64_t uintmax_t;
-
-#endif
index 618b0a7..db40f69 100644 (file)
@@ -70,7 +70,6 @@
     #if !defined(SK_WARN_UNUSED_RESULT)
         #define SK_WARN_UNUSED_RESULT
     #endif
-    #include "sk_stdint.h"
 #endif
 
 //////////////////////////////////////////////////////////////////////
 
 //////////////////////////////////////////////////////////////////////
 
-#ifndef SK_MMAP_SUPPORT
-    #ifdef SK_BUILD_FOR_WIN32
-        // by default, if we're windows, we assume we don't have mmap
-        #define SK_MMAP_SUPPORT 0
-    #else
-        #define SK_MMAP_SUPPORT 1
-    #endif
-#endif
-
-//////////////////////////////////////////////////////////////////////
-
 /**
  *  SK_CPU_SSE_LEVEL
  *
index 27f8ead..69a038c 100644 (file)
@@ -238,6 +238,7 @@ public:
 ////////////////////////////////////////////////////////////////////////////////////////
 
 #include "SkString.h"
+#include <stdio.h>
 
 struct SkFILE;
 
index f224518..219e51f 100644 (file)
 #include "SkPreConfig.h"
 #include "SkUserConfig.h"
 #include "SkPostConfig.h"
-
-#ifndef SK_IGNORE_STDINT_DOT_H
-    #include <stdint.h>
-#endif
-
-#include <stdio.h>
+#include <stdint.h>
 
 /** \file SkTypes.h
 */
index 91f1622..4e83ed8 100644 (file)
@@ -10,6 +10,7 @@
 #include "SkCanvas.h"
 #include "Sk64.h"
 #include "SkGradientShader.h"
+#include "SkString.h"
 
 static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta) {
     SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGENTA };
@@ -71,12 +72,12 @@ protected:
         SkScalar l = SK_Scalar1 * 100;
         SkScalar t = SK_Scalar1 * 100;
         draw_gradient2(canvas, SkRect::MakeXYWH(l, t, w, h), delta);
-        char txt[512];
-        sprintf(txt, "gap at \"tangent\" pt = %f", SkScalarToFloat(delta));
+        SkString txt;
+        txt.appendf("gap at \"tangent\" pt = %f", SkScalarToFloat(delta));
         SkPaint paint;
         paint.setAntiAlias(true);
         paint.setColor(SK_ColorBLACK);
-        canvas->drawText(txt, strlen(txt), l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, paint);
+        canvas->drawText(txt.c_str(), txt.size(), l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, paint);
         this->inval(NULL);
     }
 
index 51c570e..53e2199 100644 (file)
@@ -10,6 +10,7 @@
 #include "SkCanvas.h"
 #include "SkPaint.h"
 #include "SkRandom.h"
+#include "SkString.h"
 
 class EmptyPathView : public SampleView {
 public:
@@ -103,14 +104,14 @@ protected:
                 rectPaint.setAntiAlias(true);
                 canvas->drawRect(rect, rectPaint);
 
-                char label[1024];
-                sprintf(label, "%s, %s", gStyles[style].fName,
-                                         gFills[fill].fName);
+                SkString label;
+                label.appendf("%s, %s", gStyles[style].fName, gFills[fill].fName);
+
                 SkPaint labelPaint;
                 labelPaint.setColor(color);
                 labelPaint.setAntiAlias(true);
                 labelPaint.setLCDRenderText(true);
-                canvas->drawText(label, strlen(label),
+                canvas->drawText(label.c_str(), label.size(),
                                  0, rect.height() + 15 * SK_Scalar1,
                                  labelPaint);
             }
index fa6ad43..a09be28 100644 (file)
@@ -61,15 +61,15 @@ static void test_cubic2() {
         int ix = (int)x;
         int fx = (int)(x * 65536);
         int ffx = SkScalarToFixed(x);
-        printf("%g %x %x %x\n", x, ix, fx, ffx);
+        SkDebugf("%g %x %x %x\n", x, ix, fx, ffx);
 
         SkRect r = path.getBounds();
         SkIRect ir;
         r.round(&ir);
-        printf("[%g %g %g %g] [%x %x %x %x]\n",
-               SkScalarToDouble(r.fLeft), SkScalarToDouble(r.fTop),
-               SkScalarToDouble(r.fRight), SkScalarToDouble(r.fBottom),
-               ir.fLeft, ir.fTop, ir.fRight, ir.fBottom);
+        SkDebugf("[%g %g %g %g] [%x %x %x %x]\n",
+                SkScalarToDouble(r.fLeft), SkScalarToDouble(r.fTop),
+                SkScalarToDouble(r.fRight), SkScalarToDouble(r.fBottom),
+                ir.fLeft, ir.fTop, ir.fRight, ir.fBottom);
     }
 
     SkBitmap bitmap;
index 32213a1..3ac8bc2 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "SkBitmap.h"
 #include "SkImageEncoder.h"
+#include <stdio.h>
 
 SK_DEFINE_INST_COUNT(GrSurface)
 
index 0e3d2a3..ed4b50c 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "GrGLUtil.h"
 #include "SkMatrix.h"
+#include <stdio.h>
 
 void GrGLClearErr(const GrGLInterface* gl) {
     while (GR_GL_NO_ERROR != gl->fGetError()) {}
index 4fabd4c..d215518 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "SkPathOps.h"
 #include "SkTypes.h"
+#include <stdio.h>
 
 #ifdef SK_RELEASE
 #define FORCE_RELEASE 1
index d3e84a3..e471974 100644 (file)
@@ -14,6 +14,7 @@
 #include "SkRRect.h"
 #include "SkString.h"
 #include <stdarg.h>
+#include <stdio.h>
 
 // needed just to know that these are all subclassed from SkFlattenable
 #include "SkShader.h"
index e980781..d19c22d 100644 (file)
@@ -30,7 +30,7 @@ static void test_giantClip() {
 }
 
 static void PrintCurve(const char *name, const SkPoint crv[4]) {
-    printf("%s: %.10g, %.10g, %.10g, %.10g, %.10g, %.10g, %.10g, %.10g\n",
+    SkDebugf("%s: %.10g, %.10g, %.10g, %.10g, %.10g, %.10g, %.10g, %.10g\n",
             name,
             (float)crv[0].fX, (float)crv[0].fY,
             (float)crv[1].fX, (float)crv[1].fY,
index 210a7cf..42d9ca9 100644 (file)
@@ -161,7 +161,7 @@ static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
             SkString familyName;
             typeface->getFamilyName(&familyName);
             if (verbose) {
-                printf("[%s]\n", familyName.c_str());
+                SkDebugf("[%s]\n", familyName.c_str());
             }
 
             SkAutoTUnref<SkTypeface::LocalizedStrings> familyNamesIter(
@@ -169,7 +169,7 @@ static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
             SkTypeface::LocalizedString familyNameLocalized;
             while (familyNamesIter->next(&familyNameLocalized)) {
                 if (verbose) {
-                    printf("(%s) <%s>\n", familyNameLocalized.fString.c_str(),
+                    SkDebugf("(%s) <%s>\n", familyNameLocalized.fString.c_str(),
                                           familyNameLocalized.fLanguage.c_str());
                 }
             }
@@ -193,7 +193,7 @@ static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
                     "Requested family name, got something else."
                 );
                 if (verbose) {
-                    printf("{%s} <%s>\n", record.name.c_str(), record.language.c_str());
+                    SkDebugf("{%s} <%s>\n", record.name.c_str(), record.language.c_str());
                 }
             }
 
@@ -205,12 +205,12 @@ static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
                     "Requested subfamily name, got something else."
                 );
                 if (verbose) {
-                    printf("{{%s}} <%s>\n", record.name.c_str(), record.language.c_str());
+                    SkDebugf("{{%s}} <%s>\n", record.name.c_str(), record.language.c_str());
                 }
             }
 
             if (verbose) {
-                printf("\n");
+                SkDebugf("\n");
             }
         }
     }
index bc8e6a3..cfb96ad 100644 (file)
@@ -147,14 +147,14 @@ static void test_blend31() {
                 int r2 = SkScalarRoundToInt(SkFloatToScalar(f));
 
                 if (r0 != r1 && r0 != r2) {
-                    printf("src:%d dst:%d a:%d result:%d float:%g\n",
-                                 src, dst, a, r0, f);
+                    SkDebugf("src:%d dst:%d a:%d result:%d float:%g\n",
+                                  src,   dst, a,        r0,      f);
                     failed += 1;
                 }
                 if (r0 > 255) {
                     death += 1;
-                    printf("death src:%d dst:%d a:%d result:%d float:%g\n",
-                           src, dst, a, r0, f);
+                    SkDebugf("death src:%d dst:%d a:%d result:%d float:%g\n",
+                                        src,   dst, a,        r0,      f);
                 }
             }
         }
index 849f355..772d7b2 100644 (file)
@@ -64,7 +64,7 @@ static bool nearly_equal(const SkMatrix44& a, const SkMatrix44& b) {
     for (int i = 0; i < 4; ++i) {
         for (int j = 0; j < 4; ++j) {
             if (!nearly_equal_mscalar(a.get(i, j), b.get(i, j))) {
-                printf("not equal %g %g\n", a.get(i, j), b.get(i, j));
+                SkDebugf("not equal %g %g\n", a.get(i, j), b.get(i, j));
                 return false;
             }
         }
index d75de75..07eacb6 100644 (file)
@@ -26,7 +26,7 @@ static bool nearly_equal_scalar(SkScalar a, SkScalar b) {
 static bool nearly_equal(const SkMatrix& a, const SkMatrix& b) {
     for (int i = 0; i < 9; i++) {
         if (!nearly_equal_scalar(a[i], b[i])) {
-            printf("not equal %g %g\n", (float)a[i], (float)b[i]);
+            SkDebugf("not equal %g %g\n", (float)a[i], (float)b[i]);
             return false;
         }
     }
index 27cb5be..6709ae7 100644 (file)
@@ -50,14 +50,14 @@ static void standardTestCases(skiatest::Reporter* reporter) {
         const SkDQuad& quad = quadraticLines[index];
         order = reducer.reduce(quad, SkReduceOrder::kFill_Style);
         if (order != 2) {
-            printf("[%d] line quad order=%d\n", (int) index, order);
+            SkDebugf("[%d] line quad order=%d\n", (int) index, order);
         }
     }
     for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
         const SkDQuad& quad = quadraticModEpsilonLines[index];
         order = reducer.reduce(quad, SkReduceOrder::kFill_Style);
         if (order != 3) {
-            printf("[%d] line mod quad order=%d\n", (int) index, order);
+            SkDebugf("[%d] line mod quad order=%d\n", (int) index, order);
         }
     }
 }
index 3076719..462fcfa 100644 (file)
@@ -8,7 +8,7 @@
 #include "Test.h"
 #include "SkString.h"
 #include <stdarg.h>
-
+#include <stdio.h>
 
 // Windows vsnprintf doesn't 0-terminate safely), but is so far
 // encapsulated in SkString that we can't test it directly.
index bb196ef..0e39e37 100644 (file)
@@ -170,7 +170,7 @@ class TestWData {
 
         SkString stringResult = stringify_advance_data(result.get());
         if (!stringResult.equals(fExpected)) {
-            printf("Expected: %s\n  Result: %s\n", fExpected, stringResult.c_str());
+            SkDebugf("Expected: %s\n  Result: %s\n", fExpected, stringResult.c_str());
             return false;
         }
         return true;