aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/gm.h5
-rw-r--r--include/core/SkCanvas.h1
-rw-r--r--include/core/SkTime.h1
-rw-r--r--include/core/SkTypes.h43
-rw-r--r--include/private/SkMacros.h53
-rw-r--r--include/private/SkMutex.h1
-rw-r--r--samplecode/SampleCode.h1
-rw-r--r--src/codec/SkPngCodec.cpp1
-rw-r--r--src/core/SkAutoBlitterChoose.h1
-rw-r--r--src/core/SkAutoMalloc.h3
-rw-r--r--src/core/SkDescriptor.h2
-rw-r--r--src/core/SkMask.h3
-rw-r--r--src/core/SkPath.cpp1
-rw-r--r--src/core/SkRasterClip.h3
-rw-r--r--src/core/SkScopeExit.h2
-rw-r--r--src/core/SkSharedMutex.h1
-rw-r--r--src/gpu/vk/GrVkUtil.h3
-rw-r--r--src/ports/SkFontHost_win.cpp1
18 files changed, 75 insertions, 51 deletions
diff --git a/gm/gm.h b/gm/gm.h
index a8190bfff4..c79953273d 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -8,14 +8,15 @@
#ifndef skiagm_DEFINED
#define skiagm_DEFINED
+#include "../tools/Registry.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
+#include "SkClipOpPriv.h"
+#include "SkMacros.h"
#include "SkMetaData.h"
#include "SkPaint.h"
#include "SkSize.h"
#include "SkString.h"
-#include "../tools/Registry.h"
-#include "SkClipOpPriv.h"
class SkAnimTimer;
struct GrContextOptions;
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index d3b2e5890e..f42c5a3db9 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -18,6 +18,7 @@
#ifndef SkCanvas_DEFINED
#define SkCanvas_DEFINED
+#include "../private/SkMacros.h"
#include "SkBlendMode.h"
#include "SkClipOp.h"
#include "SkDeque.h"
diff --git a/include/core/SkTime.h b/include/core/SkTime.h
index e9a894812b..8a40c21313 100644
--- a/include/core/SkTime.h
+++ b/include/core/SkTime.h
@@ -10,6 +10,7 @@
#ifndef SkTime_DEFINED
#define SkTime_DEFINED
+#include "../private/SkMacros.h"
#include "SkTypes.h"
class SkString;
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index db694e9f8b..65867509e5 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -82,49 +82,6 @@ SK_API extern void sk_abort_no_print(void);
// depend on SkString forward declaration below. Remove this once dependencies are fixed.
class SkString;
-/*
- * Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab
- *
- * SK_MACRO_CONCAT_IMPL_PRIV just exists to make this work. Do not use directly
- *
- */
-#define SK_MACRO_CONCAT(X, Y) SK_MACRO_CONCAT_IMPL_PRIV(X, Y)
-#define SK_MACRO_CONCAT_IMPL_PRIV(X, Y) X ## Y
-
-/*
- * Usage: SK_MACRO_APPEND_LINE(foo) to make foo123, where 123 is the current
- * line number. Easy way to construct
- * unique names for local functions or
- * variables.
- */
-#define SK_MACRO_APPEND_LINE(name) SK_MACRO_CONCAT(name, __LINE__)
-
-/**
- * For some classes, it's almost always an error to instantiate one without a name, e.g.
- * {
- * SkAutoMutexAcquire(&mutex);
- * <some code>
- * }
- * In this case, the writer meant to hold mutex while the rest of the code in the block runs,
- * but instead the mutex is acquired and then immediately released. The correct usage is
- * {
- * SkAutoMutexAcquire lock(&mutex);
- * <some code>
- * }
- *
- * To prevent callers from instantiating your class without a name, use SK_REQUIRE_LOCAL_VAR
- * like this:
- * class classname {
- * <your class>
- * };
- * #define classname(...) SK_REQUIRE_LOCAL_VAR(classname)
- *
- * This won't work with templates, and you must inline the class' constructors and destructors.
- * Take a look at SkAutoFree and SkAutoMalloc in this file for examples.
- */
-#define SK_REQUIRE_LOCAL_VAR(classname) \
- static_assert(false, "missing name for " #classname)
-
///////////////////////////////////////////////////////////////////////
/**
diff --git a/include/private/SkMacros.h b/include/private/SkMacros.h
new file mode 100644
index 0000000000..3d79d52230
--- /dev/null
+++ b/include/private/SkMacros.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef SkMacros_DEFINED
+#define SkMacros_DEFINED
+
+/*
+ * Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab
+ *
+ * SK_MACRO_CONCAT_IMPL_PRIV just exists to make this work. Do not use directly
+ *
+ */
+#define SK_MACRO_CONCAT(X, Y) SK_MACRO_CONCAT_IMPL_PRIV(X, Y)
+#define SK_MACRO_CONCAT_IMPL_PRIV(X, Y) X ## Y
+
+/*
+ * Usage: SK_MACRO_APPEND_LINE(foo) to make foo123, where 123 is the current
+ * line number. Easy way to construct
+ * unique names for local functions or
+ * variables.
+ */
+#define SK_MACRO_APPEND_LINE(name) SK_MACRO_CONCAT(name, __LINE__)
+
+/**
+ * For some classes, it's almost always an error to instantiate one without a name, e.g.
+ * {
+ * SkAutoMutexAcquire(&mutex);
+ * <some code>
+ * }
+ * In this case, the writer meant to hold mutex while the rest of the code in the block runs,
+ * but instead the mutex is acquired and then immediately released. The correct usage is
+ * {
+ * SkAutoMutexAcquire lock(&mutex);
+ * <some code>
+ * }
+ *
+ * To prevent callers from instantiating your class without a name, use SK_REQUIRE_LOCAL_VAR
+ * like this:
+ * class classname {
+ * <your class>
+ * };
+ * #define classname(...) SK_REQUIRE_LOCAL_VAR(classname)
+ *
+ * This won't work with templates, and you must inline the class' constructors and destructors.
+ * Take a look at SkAutoFree and SkAutoMalloc in this file for examples.
+ */
+#define SK_REQUIRE_LOCAL_VAR(classname) \
+ static_assert(false, "missing name for " #classname)
+
+#endif // SkMacros_DEFINED
diff --git a/include/private/SkMutex.h b/include/private/SkMutex.h
index 7cfdb1132c..9af23adadf 100644
--- a/include/private/SkMutex.h
+++ b/include/private/SkMutex.h
@@ -8,6 +8,7 @@
#ifndef SkMutex_DEFINED
#define SkMutex_DEFINED
+#include "../private/SkMacros.h"
#include "../private/SkSemaphore.h"
#include "../private/SkThreadID.h"
#include "SkTypes.h"
diff --git a/samplecode/SampleCode.h b/samplecode/SampleCode.h
index 053d6821a2..3310d28beb 100644
--- a/samplecode/SampleCode.h
+++ b/samplecode/SampleCode.h
@@ -10,6 +10,7 @@
#include "SkColor.h"
#include "SkEvent.h"
+#include "SkMacros.h"
#include "SkView.h"
class SkAnimTimer;
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 31a407c670..1cb1c74621 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -11,6 +11,7 @@
#include "SkColorSpace.h"
#include "SkColorSpacePriv.h"
#include "SkColorTable.h"
+#include "SkMacros.h"
#include "SkMath.h"
#include "SkOpts.h"
#include "SkPngCodec.h"
diff --git a/src/core/SkAutoBlitterChoose.h b/src/core/SkAutoBlitterChoose.h
index b6c0433fbf..40d438e02c 100644
--- a/src/core/SkAutoBlitterChoose.h
+++ b/src/core/SkAutoBlitterChoose.h
@@ -11,6 +11,7 @@
#include "SkArenaAlloc.h"
#include "SkBlitter.h"
#include "SkDraw.h"
+#include "SkMacros.h"
class SkMatrix;
class SkPaint;
diff --git a/src/core/SkAutoMalloc.h b/src/core/SkAutoMalloc.h
index f5c872954d..9c6dad959e 100644
--- a/src/core/SkAutoMalloc.h
+++ b/src/core/SkAutoMalloc.h
@@ -8,8 +8,9 @@
#ifndef SkAutoMalloc_DEFINED
#define SkAutoMalloc_DEFINED
-#include "SkTypes.h"
+#include "SkMacros.h"
#include "SkMalloc.h"
+#include "SkTypes.h"
#include <memory>
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h
index 4bae7be8f6..7f1939dcc2 100644
--- a/src/core/SkDescriptor.h
+++ b/src/core/SkDescriptor.h
@@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
-
#ifndef SkDescriptor_DEFINED
#define SkDescriptor_DEFINED
+#include "SkMacros.h"
#include "SkOpts.h"
#include "SkTo.h"
#include "SkTypes.h"
diff --git a/src/core/SkMask.h b/src/core/SkMask.h
index 337664d9da..89d83528d9 100644
--- a/src/core/SkMask.h
+++ b/src/core/SkMask.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,11 +5,11 @@
* found in the LICENSE file.
*/
-
#ifndef SkMask_DEFINED
#define SkMask_DEFINED
#include "SkColorPriv.h"
+#include "SkMacros.h"
#include "SkRect.h"
#include "SkTemplates.h"
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index cabc116ea1..605454bcf7 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -11,6 +11,7 @@
#include "SkCubicClipper.h"
#include "SkData.h"
#include "SkGeometry.h"
+#include "SkMacros.h"
#include "SkMath.h"
#include "SkMatrixPriv.h"
#include "SkPathPriv.h"
diff --git a/src/core/SkRasterClip.h b/src/core/SkRasterClip.h
index e7d77ab370..ff80824afd 100644
--- a/src/core/SkRasterClip.h
+++ b/src/core/SkRasterClip.h
@@ -8,8 +8,9 @@
#ifndef SkRasterClip_DEFINED
#define SkRasterClip_DEFINED
-#include "SkRegion.h"
#include "SkAAClip.h"
+#include "SkMacros.h"
+#include "SkRegion.h"
class SkRRect;
diff --git a/src/core/SkScopeExit.h b/src/core/SkScopeExit.h
index bdec7b34f0..4c9adcd0d8 100644
--- a/src/core/SkScopeExit.h
+++ b/src/core/SkScopeExit.h
@@ -9,6 +9,8 @@
#define SkScopeExit_DEFINED
#include "SkTypes.h"
+#include "SkMacros.h"
+
#include <functional>
/** SkScopeExit calls a std:::function<void()> in its destructor. */
diff --git a/src/core/SkSharedMutex.h b/src/core/SkSharedMutex.h
index 21c9f46d64..33f1f10246 100644
--- a/src/core/SkSharedMutex.h
+++ b/src/core/SkSharedMutex.h
@@ -9,6 +9,7 @@
#define SkSharedLock_DEFINED
#include "SkAtomics.h"
+#include "SkMacros.h"
#include "SkSemaphore.h"
#include "SkTypes.h"
diff --git a/src/gpu/vk/GrVkUtil.h b/src/gpu/vk/GrVkUtil.h
index 08eef1a1d0..71cc5d4e6a 100644
--- a/src/gpu/vk/GrVkUtil.h
+++ b/src/gpu/vk/GrVkUtil.h
@@ -10,9 +10,10 @@
#include "GrColor.h"
#include "GrTypes.h"
+#include "SkMacros.h"
+#include "ir/SkSLProgram.h"
#include "vk/GrVkDefines.h"
#include "vk/GrVkInterface.h"
-#include "ir/SkSLProgram.h"
class GrVkGpu;
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index d98e68fc9f..85e92ce840 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -16,6 +16,7 @@
#include "SkFontDescriptor.h"
#include "SkGlyph.h"
#include "SkHRESULT.h"
+#include "SkMacros.h"
#include "SkMakeUnique.h"
#include "SkMaskGamma.h"
#include "SkMatrix22.h"