diff options
author | Hal Canary <halcanary@google.com> | 2018-06-12 14:50:37 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-12 20:24:43 +0000 |
commit | 50dbc0949fb256a316163143e649028eeed2970a (patch) | |
tree | b0069d2b47cccfb207d4a5245f18a6b9455c3300 | |
parent | bc718c1e9ce0b4c2d10458f4c3549fd98e10a9f2 (diff) |
SkTypes: more into SkMacros
Change-Id: I4c9a2d81a1bc4ccebc78eea56c0de116b98d415e
Reviewed-on: https://skia-review.googlesource.com/134330
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
-rw-r--r-- | include/core/SkMatrix.h | 3 | ||||
-rw-r--r-- | include/core/SkStrokeRec.h | 1 | ||||
-rw-r--r-- | include/core/SkTypes.h | 12 | ||||
-rw-r--r-- | include/private/SkMacros.h | 14 | ||||
-rw-r--r-- | samplecode/SampleAAGeometry.cpp | 1 | ||||
-rw-r--r-- | src/core/SkAAClip.cpp | 1 | ||||
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 1 | ||||
-rw-r--r-- | src/core/SkDraw.cpp | 1 | ||||
-rw-r--r-- | src/core/SkEdgeClipper.cpp | 2 | ||||
-rw-r--r-- | src/core/SkRegion.cpp | 1 | ||||
-rw-r--r-- | src/core/SkScalerContext.h | 1 | ||||
-rw-r--r-- | src/core/SkScan_Path.cpp | 5 | ||||
-rw-r--r-- | src/core/SkStroke.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrBufferAllocPool.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrTestUtils.h | 1 | ||||
-rw-r--r-- | src/pathops/SkPathOpsCommon.cpp | 2 | ||||
-rw-r--r-- | src/pathops/SkPathOpsTSect.h | 3 | ||||
-rw-r--r-- | src/pdf/SkPDFCanon.h | 3 | ||||
-rw-r--r-- | src/pdf/SkPDFFont.cpp | 1 | ||||
-rw-r--r-- | src/pdf/SkPDFGraphicState.h | 3 | ||||
-rw-r--r-- | src/pdf/SkPDFShader.h | 1 | ||||
-rw-r--r-- | src/utils/mac/SkCreateCGImageRef.cpp | 1 | ||||
-rw-r--r-- | tests/PathOpsSimplifyRectThreadedTest.cpp | 2 |
23 files changed, 44 insertions, 20 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index bedb536f18..84f805c637 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -18,8 +18,9 @@ #ifndef SkMatrix_DEFINED #define SkMatrix_DEFINED -#include "SkRect.h" +#include "../private/SkMacros.h" #include "../private/SkTo.h" +#include "SkRect.h" struct SkRSXform; struct SkPoint3; diff --git a/include/core/SkStrokeRec.h b/include/core/SkStrokeRec.h index ae059a9d51..deabc9edc8 100644 --- a/include/core/SkStrokeRec.h +++ b/include/core/SkStrokeRec.h @@ -8,6 +8,7 @@ #ifndef SkStrokeRec_DEFINED #define SkStrokeRec_DEFINED +#include "../private/SkMacros.h" #include "SkPaint.h" class SkPath; diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index ef27a7f42b..3ef236e7f4 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -35,8 +35,6 @@ */ SK_API extern void sk_abort_no_print(void); -#define SK_INIT_TO_AVOID_WARNING = 0 - #ifndef SkDebugf SK_API void SkDebugf(const char format[], ...); #endif @@ -140,16 +138,6 @@ inline constexpr int64_t SkLeftShift(int64_t value, int32_t shift) { template <typename T, size_t N> char (&SkArrayCountHelper(T (&array)[N]))[N]; #define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array))) -// Can be used to bracket data types that must be dense, e.g. hash keys. -#if defined(__clang__) // This should work on GCC too, but GCC diagnostic pop didn't seem to work! - #define SK_BEGIN_REQUIRE_DENSE _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic error \"-Wpadded\"") - #define SK_END_REQUIRE_DENSE _Pragma("GCC diagnostic pop") -#else - #define SK_BEGIN_REQUIRE_DENSE - #define SK_END_REQUIRE_DENSE -#endif - //////////////////////////////////////////////////////////////////////////////// template <typename T> inline constexpr T SkAlign2(T x) { return (x + 1) >> 1 << 1; } diff --git a/include/private/SkMacros.h b/include/private/SkMacros.h index 3d79d52230..a68193228f 100644 --- a/include/private/SkMacros.h +++ b/include/private/SkMacros.h @@ -50,4 +50,18 @@ #define SK_REQUIRE_LOCAL_VAR(classname) \ static_assert(false, "missing name for " #classname) +//////////////////////////////////////////////////////////////////////////////// + +// Can be used to bracket data types that must be dense, e.g. hash keys. +#if defined(__clang__) // This should work on GCC too, but GCC diagnostic pop didn't seem to work! + #define SK_BEGIN_REQUIRE_DENSE _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic error \"-Wpadded\"") + #define SK_END_REQUIRE_DENSE _Pragma("GCC diagnostic pop") +#else + #define SK_BEGIN_REQUIRE_DENSE + #define SK_END_REQUIRE_DENSE +#endif + +#define SK_INIT_TO_AVOID_WARNING = 0 + #endif // SkMacros_DEFINED diff --git a/samplecode/SampleAAGeometry.cpp b/samplecode/SampleAAGeometry.cpp index 75657a1883..c431033d20 100644 --- a/samplecode/SampleAAGeometry.cpp +++ b/samplecode/SampleAAGeometry.cpp @@ -10,6 +10,7 @@ #include "SkCanvas.h" #include "SkGeometry.h" #include "SkIntersections.h" +#include "SkMacros.h" #include "SkOpEdgeBuilder.h" // #include "SkPathOpsSimplifyAA.h" // #include "SkPathStroker.h" diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp index 54d6726e65..46c09e0ca5 100644 --- a/src/core/SkAAClip.cpp +++ b/src/core/SkAAClip.cpp @@ -10,6 +10,7 @@ #include "SkAtomics.h" #include "SkBlitter.h" #include "SkColorData.h" +#include "SkMacros.h" #include "SkPath.h" #include "SkRectPriv.h" #include "SkScan.h" diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index 2f727397d9..105637176a 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -9,6 +9,7 @@ #include "SkBitmapController.h" #include "SkBitmapProcState.h" #include "SkColorData.h" +#include "SkMacros.h" #include "SkPaint.h" #include "SkShader.h" // for tilemodes #include "SkUtilsArm.h" diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 14c1063668..58489b9ec8 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -17,6 +17,7 @@ #include "SkDrawProcs.h" #include "SkFindAndPlaceGlyph.h" #include "SkMaskFilterBase.h" +#include "SkMacros.h" #include "SkMatrix.h" #include "SkMatrixUtils.h" #include "SkPaint.h" diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp index 2abbd1b1d4..b2b95fc78e 100644 --- a/src/core/SkEdgeClipper.cpp +++ b/src/core/SkEdgeClipper.cpp @@ -5,10 +5,10 @@ * found in the LICENSE file. */ - #include "SkEdgeClipper.h" #include "SkGeometry.h" #include "SkLineClipper.h" +#include "SkMacros.h" static bool quick_reject(const SkRect& bounds, const SkRect& clip) { return bounds.fTop >= clip.fBottom || bounds.fBottom <= clip.fTop; diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index 6ae8e5b5f9..3d48f3696b 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -8,6 +8,7 @@ #include "SkRegion.h" #include "SkAtomics.h" +#include "SkMacros.h" #include "SkRegionPriv.h" #include "SkSafeMath.h" #include "SkTemplates.h" diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h index 4a799f90dd..6d4b9151ee 100644 --- a/src/core/SkScalerContext.h +++ b/src/core/SkScalerContext.h @@ -11,6 +11,7 @@ #include <memory> #include "SkGlyph.h" +#include "SkMacros.h" #include "SkMask.h" #include "SkMaskFilter.h" #include "SkMaskGamma.h" diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp index 89ef4ca32d..c26a22476e 100644 --- a/src/core/SkScan_Path.cpp +++ b/src/core/SkScan_Path.cpp @@ -5,19 +5,20 @@ * found in the LICENSE file. */ -#include "SkScanPriv.h" #include "SkBlitter.h" #include "SkEdge.h" #include "SkEdgeBuilder.h" #include "SkGeometry.h" +#include "SkMacros.h" #include "SkPath.h" #include "SkQuadClipper.h" #include "SkRasterClip.h" #include "SkRectPriv.h" #include "SkRegion.h" #include "SkSafe32.h" -#include "SkTemplates.h" +#include "SkScanPriv.h" #include "SkTSort.h" +#include "SkTemplates.h" #define kEDGE_HEAD_Y SK_MinS32 #define kEDGE_TAIL_Y SK_MaxS32 diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp index f08ea2b211..bb216d12d1 100644 --- a/src/core/SkStroke.cpp +++ b/src/core/SkStroke.cpp @@ -8,6 +8,7 @@ #include "SkStrokerPriv.h" #include "SkGeometry.h" +#include "SkMacros.h" #include "SkPathPriv.h" #include "SkPointPriv.h" #include "SkTo.h" diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp index 5b0d8cc6d7..c47881c6c5 100644 --- a/src/gpu/GrBufferAllocPool.cpp +++ b/src/gpu/GrBufferAllocPool.cpp @@ -5,8 +5,8 @@ * found in the LICENSE file. */ - #include "GrBufferAllocPool.h" + #include "GrBuffer.h" #include "GrCaps.h" #include "GrContext.h" @@ -14,6 +14,7 @@ #include "GrGpu.h" #include "GrResourceProvider.h" #include "GrTypes.h" +#include "SkMacros.h" #include "SkSafeMath.h" #include "SkTraceEvent.h" diff --git a/src/gpu/GrTestUtils.h b/src/gpu/GrTestUtils.h index 7627df4b19..64c7662043 100644 --- a/src/gpu/GrTestUtils.h +++ b/src/gpu/GrTestUtils.h @@ -16,6 +16,7 @@ #include "GrColor.h" #include "GrFPArgs.h" #include "GrSamplerState.h" +#include "SkMacros.h" #include "SkPathEffect.h" #include "SkRandom.h" #include "SkShaderBase.h" diff --git a/src/pathops/SkPathOpsCommon.cpp b/src/pathops/SkPathOpsCommon.cpp index feba8d38a8..19e80b0b67 100644 --- a/src/pathops/SkPathOpsCommon.cpp +++ b/src/pathops/SkPathOpsCommon.cpp @@ -4,9 +4,11 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "SkAddIntersections.h" #include "SkOpCoincidence.h" #include "SkOpEdgeBuilder.h" +#include "SkMacros.h" #include "SkPathOpsCommon.h" #include "SkPathWriter.h" #include "SkTSort.h" diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h index 4dc2b34bb7..b052df97db 100644 --- a/src/pathops/SkPathOpsTSect.h +++ b/src/pathops/SkPathOpsTSect.h @@ -8,9 +8,10 @@ #define SkPathOpsTSect_DEFINED #include "SkArenaAlloc.h" +#include "SkIntersections.h" +#include "SkMacros.h" #include "SkPathOpsBounds.h" #include "SkPathOpsRect.h" -#include "SkIntersections.h" #include "SkTSort.h" #ifdef SK_DEBUG diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h index 8e97db05f5..58103782e8 100644 --- a/src/pdf/SkPDFCanon.h +++ b/src/pdf/SkPDFCanon.h @@ -10,13 +10,14 @@ #include <vector> #include "SkBitmapKey.h" +#include "SkMacros.h" #include "SkPDFGradientShader.h" #include "SkPDFGraphicState.h" #include "SkPDFShader.h" +#include "SkString.h" #include "SkTDArray.h" #include "SkTHash.h" #include "SkTypeface.h" -#include "SkString.h" class SkPDFFont; struct SkAdvancedTypefaceMetrics; diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp index 4556bcd2b3..16f78a66ea 100644 --- a/src/pdf/SkPDFFont.cpp +++ b/src/pdf/SkPDFFont.cpp @@ -9,6 +9,7 @@ #include "SkData.h" #include "SkGlyphCache.h" +#include "SkMacros.h" #include "SkMakeUnique.h" #include "SkPDFCanon.h" #include "SkPDFConvertType1FontStream.h" diff --git a/src/pdf/SkPDFGraphicState.h b/src/pdf/SkPDFGraphicState.h index 4323252bcd..a9f79ad35e 100644 --- a/src/pdf/SkPDFGraphicState.h +++ b/src/pdf/SkPDFGraphicState.h @@ -9,8 +9,9 @@ #ifndef SkPDFGraphicState_DEFINED #define SkPDFGraphicState_DEFINED -#include "SkPDFTypes.h" +#include "SkMacros.h" #include "SkOpts.h" +#include "SkPDFTypes.h" class SkPaint; class SkPDFCanon; diff --git a/src/pdf/SkPDFShader.h b/src/pdf/SkPDFShader.h index c1a5ef30ab..b003e34d0b 100644 --- a/src/pdf/SkPDFShader.h +++ b/src/pdf/SkPDFShader.h @@ -10,6 +10,7 @@ #define SkPDFShader_DEFINED #include "SkBitmapKey.h" +#include "SkMacros.h" #include "SkPDFTypes.h" #include "SkShader.h" diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp index 623b3e7b17..300e23b216 100644 --- a/src/utils/mac/SkCreateCGImageRef.cpp +++ b/src/utils/mac/SkCreateCGImageRef.cpp @@ -11,6 +11,7 @@ #include "SkBitmap.h" #include "SkCGUtils.h" #include "SkColorData.h" +#include "SkMacros.h" #include "SkTo.h" static CGBitmapInfo ComputeCGAlphaInfo_RGBA(SkAlphaType at) { diff --git a/tests/PathOpsSimplifyRectThreadedTest.cpp b/tests/PathOpsSimplifyRectThreadedTest.cpp index 384d1b0cce..d7c40b1119 100644 --- a/tests/PathOpsSimplifyRectThreadedTest.cpp +++ b/tests/PathOpsSimplifyRectThreadedTest.cpp @@ -4,8 +4,10 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "PathOpsExtendedTest.h" #include "PathOpsThreadedCommon.h" +#include "SkMacros.h" #include "SkString.h" // four rects, of four sizes |