aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-11 18:50:45 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-11 18:50:45 +0000
commitfab44db294846ff05d837b9cf0bf97a073891da7 (patch)
tree76bba06175f7c85f25c22779149e1355f9bd1f9c
parentdcb4e65998913bfb2cc7e331ffacf0965bdee0ea (diff)
Clean up SkTypes.h.
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
-rw-r--r--bench/SkBenchLogger.h1
-rw-r--r--gyp/common_conditions.gypi1
-rw-r--r--include/config/sk_stdint.h23
-rw-r--r--include/core/SkPreConfig.h12
-rw-r--r--include/core/SkStream.h1
-rw-r--r--include/core/SkTypes.h7
-rw-r--r--samplecode/SampleDegenerateTwoPtRadials.cpp7
-rw-r--r--samplecode/SampleEmptyPath.cpp9
-rw-r--r--samplecode/SamplePath.cpp10
-rw-r--r--src/gpu/GrSurface.cpp1
-rw-r--r--src/gpu/gl/GrGLUtil.cpp1
-rw-r--r--src/pathops/SkPathOpsDebug.h1
-rw-r--r--src/utils/SkDumpCanvas.cpp1
-rw-r--r--tests/ClipCubicTest.cpp2
-rw-r--r--tests/FontNamesTest.cpp10
-rw-r--r--tests/MathTest.cpp8
-rw-r--r--tests/Matrix44Test.cpp2
-rw-r--r--tests/MatrixTest.cpp2
-rw-r--r--tests/PathOpsQuadReduceOrderTest.cpp4
-rw-r--r--tests/StringTest.cpp2
-rw-r--r--tests/WArrayTest.cpp2
21 files changed, 37 insertions, 70 deletions
diff --git a/bench/SkBenchLogger.h b/bench/SkBenchLogger.h
index 21d64e4ea6..77a08373bf 100644
--- a/bench/SkBenchLogger.h
+++ b/bench/SkBenchLogger.h
@@ -11,6 +11,7 @@
#include "SkTypes.h"
#include "SkString.h"
+#include <stdio.h>
class SkFILEWStream;
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 8fce3ca67a..d6154caee3 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -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
index 360755e75b..0000000000
--- a/include/config/sk_stdint.h
+++ /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
diff --git a/include/core/SkPreConfig.h b/include/core/SkPreConfig.h
index 618b0a7870..db40f695b0 100644
--- a/include/core/SkPreConfig.h
+++ b/include/core/SkPreConfig.h
@@ -70,7 +70,6 @@
#if !defined(SK_WARN_UNUSED_RESULT)
#define SK_WARN_UNUSED_RESULT
#endif
- #include "sk_stdint.h"
#endif
//////////////////////////////////////////////////////////////////////
@@ -102,17 +101,6 @@
//////////////////////////////////////////////////////////////////////
-#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
*
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 27f8ead141..69a038cd57 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -238,6 +238,7 @@ public:
////////////////////////////////////////////////////////////////////////////////////////
#include "SkString.h"
+#include <stdio.h>
struct SkFILE;
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index f2245184e6..219e51fbe9 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -13,12 +13,7 @@
#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
*/
diff --git a/samplecode/SampleDegenerateTwoPtRadials.cpp b/samplecode/SampleDegenerateTwoPtRadials.cpp
index 91f1622b69..4e83ed8f0a 100644
--- a/samplecode/SampleDegenerateTwoPtRadials.cpp
+++ b/samplecode/SampleDegenerateTwoPtRadials.cpp
@@ -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);
}
diff --git a/samplecode/SampleEmptyPath.cpp b/samplecode/SampleEmptyPath.cpp
index 51c570eb43..53e2199853 100644
--- a/samplecode/SampleEmptyPath.cpp
+++ b/samplecode/SampleEmptyPath.cpp
@@ -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);
}
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index fa6ad43464..a09be281b4 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -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;
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 32213a1841..3ac8bc2280 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -9,6 +9,7 @@
#include "SkBitmap.h"
#include "SkImageEncoder.h"
+#include <stdio.h>
SK_DEFINE_INST_COUNT(GrSurface)
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 0e3d2a3f7b..ed4b50c49f 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -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()) {}
diff --git a/src/pathops/SkPathOpsDebug.h b/src/pathops/SkPathOpsDebug.h
index 4fabd4cb22..d2155188da 100644
--- a/src/pathops/SkPathOpsDebug.h
+++ b/src/pathops/SkPathOpsDebug.h
@@ -9,6 +9,7 @@
#include "SkPathOps.h"
#include "SkTypes.h"
+#include <stdio.h>
#ifdef SK_RELEASE
#define FORCE_RELEASE 1
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index d3e84a31f1..e471974d13 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -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"
diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp
index e980781d28..d19c22dc9c 100644
--- a/tests/ClipCubicTest.cpp
+++ b/tests/ClipCubicTest.cpp
@@ -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,
diff --git a/tests/FontNamesTest.cpp b/tests/FontNamesTest.cpp
index 210a7cf310..42d9ca9f51 100644
--- a/tests/FontNamesTest.cpp
+++ b/tests/FontNamesTest.cpp
@@ -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");
}
}
}
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index bc8e6a32de..cfb96ad8bb 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -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);
}
}
}
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp
index 849f355489..772d7b2cf3 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -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;
}
}
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index d75de758f8..07eacb6f44 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -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;
}
}
diff --git a/tests/PathOpsQuadReduceOrderTest.cpp b/tests/PathOpsQuadReduceOrderTest.cpp
index 27cb5be6b8..6709ae771b 100644
--- a/tests/PathOpsQuadReduceOrderTest.cpp
+++ b/tests/PathOpsQuadReduceOrderTest.cpp
@@ -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);
}
}
}
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 3076719040..462fcfadaf 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -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.
diff --git a/tests/WArrayTest.cpp b/tests/WArrayTest.cpp
index bb196eff2e..0e39e3715b 100644
--- a/tests/WArrayTest.cpp
+++ b/tests/WArrayTest.cpp
@@ -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;