diff options
author | 2015-08-26 05:15:46 -0700 | |
---|---|---|
committer | 2015-08-26 05:15:46 -0700 | |
commit | 60e0fee6d4acff638ccc9670c4055aced529a7a0 (patch) | |
tree | 8f73b02cd0bfbb7d6d64982ed4ebd8776d4a5a28 /src | |
parent | 8d624bd44ef9e6d4ab7b768c4cbaa41cba830eda (diff) |
Remove include of stdlib.h from SkTypes.h.
Unfortunately, immintrin.h (which is also included by SkTypes)
includes xmmintrin.h which includes mm_malloc.h which includes
stdlib.h for malloc even though, from the implementation, it is
difficult to see why.
Fortunately, arm_neon.h does not seem to be involved in such
shenanigans, so building for Android will keep things sane.
TBR=reed@google.com
Doesn't change Skia API, just moves an include.
Review URL: https://codereview.chromium.org/1313203003
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkGraphics.cpp | 2 | ||||
-rw-r--r-- | src/core/SkRegion_path.cpp | 15 | ||||
-rw-r--r-- | src/core/SkResourceCache.cpp | 1 | ||||
-rw-r--r-- | src/core/SkTime.cpp | 4 | ||||
-rw-r--r-- | src/pathops/SkOpAngle.cpp | 2 | ||||
-rw-r--r-- | src/pathops/SkOpSegment.cpp | 10 | ||||
-rwxr-xr-x | src/pathops/SkOpSpan.cpp | 4 | ||||
-rw-r--r-- | src/pathops/SkPathOpsDebug.h | 2 | ||||
-rw-r--r-- | src/pathops/SkPathOpsTypes.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkEventTracer.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkParse.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkRTConf.cpp | 2 |
12 files changed, 30 insertions, 18 deletions
diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index 093e7a6f3b..f8d8b09db4 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -28,6 +28,8 @@ #include "SkUtils.h" #include "SkXfermode.h" +#include <stdlib.h> + void SkGraphics::GetVersion(int32_t* major, int32_t* minor, int32_t* patch) { if (major) { *major = SKIA_VERSION_MAJOR; diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp index ad01cacfba..b07d679aa1 100644 --- a/src/core/SkRegion_path.cpp +++ b/src/core/SkRegion_path.cpp @@ -8,6 +8,7 @@ #include "SkRegionPriv.h" #include "SkBlitter.h" #include "SkScan.h" +#include "SkTSort.h" #include "SkTDArray.h" #include "SkPath.h" @@ -476,11 +477,11 @@ static int extract_path(Edge* edge, Edge* stop, SkPath* path) { return count; } -#include "SkTSearch.h" - -static int EdgeProc(const Edge* a, const Edge* b) { - return (a->fX == b->fX) ? a->top() - b->top() : a->fX - b->fX; -} +struct EdgeLT { + bool operator()(const Edge& a, const Edge& b) const { + return (a.fX == b.fX) ? a.top() < b.top() : a.fX < b.fX; + } +}; bool SkRegion::getBoundaryPath(SkPath* path) const { // path could safely be NULL if we're empty, but the caller shouldn't @@ -508,13 +509,13 @@ bool SkRegion::getBoundaryPath(SkPath* path) const { edge[0].set(r.fLeft, r.fBottom, r.fTop); edge[1].set(r.fRight, r.fTop, r.fBottom); } - qsort(edges.begin(), edges.count(), sizeof(Edge), SkCastForQSort(EdgeProc)); int count = edges.count(); Edge* start = edges.begin(); Edge* stop = start + count; - Edge* e; + SkTQSort<Edge>(start, stop - 1, EdgeLT()); + Edge* e; for (e = start; e != stop; e++) { find_link(e, stop); } diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp index 70dc8f97d8..922fc7ee0a 100644 --- a/src/core/SkResourceCache.cpp +++ b/src/core/SkResourceCache.cpp @@ -13,6 +13,7 @@ #include "SkResourceCache.h" #include <stddef.h> +#include <stdlib.h> DECLARE_SKMESSAGEBUS_MESSAGE(SkResourceCache::PurgeSharedIDMessage) diff --git a/src/core/SkTime.cpp b/src/core/SkTime.cpp index b8e42365ef..fa6c04447d 100644 --- a/src/core/SkTime.cpp +++ b/src/core/SkTime.cpp @@ -12,8 +12,8 @@ void SkTime::DateTime::toISO8601(SkString* dst) const { if (dst) { int timeZoneMinutes = SkToInt(fTimeZoneMinutes); char timezoneSign = timeZoneMinutes >= 0 ? '+' : '-'; - int timeZoneHours = abs(timeZoneMinutes) / 60; - timeZoneMinutes = abs(timeZoneMinutes) % 60; + int timeZoneHours = SkTAbs(timeZoneMinutes) / 60; + timeZoneMinutes = SkTAbs(timeZoneMinutes) % 60; dst->printf("%04u-%02u-%02uT%02u:%02u:%02u%c%02d:%02d", static_cast<unsigned>(fYear), static_cast<unsigned>(fMonth), static_cast<unsigned>(fDay), static_cast<unsigned>(fHour), diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp index 36c0dd90f7..ac596fd408 100644 --- a/src/pathops/SkOpAngle.cpp +++ b/src/pathops/SkOpAngle.cpp @@ -809,7 +809,7 @@ bool SkOpAngle::midToSide(const SkOpAngle* rh, bool* inside) const { } bool SkOpAngle::oppositePlanes(const SkOpAngle* rh) const { - int startSpan = abs(rh->fSectorStart - fSectorStart); + int startSpan = SkTAbs(rh->fSectorStart - fSectorStart); return startSpan >= 8; } diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp index fc32643558..a52ef4ace1 100644 --- a/src/pathops/SkOpSegment.cpp +++ b/src/pathops/SkOpSegment.cpp @@ -1479,7 +1479,7 @@ void SkOpSegment::setUpWindings(SkOpSpanBase* start, SkOpSpanBase* end, int* sum int deltaSum = SpanSign(start, end); *maxWinding = *sumMiWinding; *sumWinding = *sumMiWinding -= deltaSum; - SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(*sumWinding) <= DEBUG_LIMIT_WIND_SUM); + SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(*sumWinding) <= DEBUG_LIMIT_WIND_SUM); } void SkOpSegment::setUpWindings(SkOpSpanBase* start, SkOpSpanBase* end, int* sumMiWinding, @@ -1498,8 +1498,8 @@ void SkOpSegment::setUpWindings(SkOpSpanBase* start, SkOpSpanBase* end, int* sum *oppMaxWinding = *sumSuWinding; *oppSumWinding = *sumSuWinding -= oppDeltaSum; } - SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(*sumWinding) <= DEBUG_LIMIT_WIND_SUM); - SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(*oppSumWinding) <= DEBUG_LIMIT_WIND_SUM); + SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(*sumWinding) <= DEBUG_LIMIT_WIND_SUM); + SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(*oppSumWinding) <= DEBUG_LIMIT_WIND_SUM); } void SkOpSegment::sortAngles() { @@ -1774,8 +1774,8 @@ int SkOpSegment::updateWindingReverse(const SkOpAngle* angle) { bool SkOpSegment::UseInnerWinding(int outerWinding, int innerWinding) { SkASSERT(outerWinding != SK_MaxS32); SkASSERT(innerWinding != SK_MaxS32); - int absOut = abs(outerWinding); - int absIn = abs(innerWinding); + int absOut = SkTAbs(outerWinding); + int absIn = SkTAbs(innerWinding); bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; return result; } diff --git a/src/pathops/SkOpSpan.cpp b/src/pathops/SkOpSpan.cpp index 5c89c736fb..df3ef3c9b3 100755 --- a/src/pathops/SkOpSpan.cpp +++ b/src/pathops/SkOpSpan.cpp @@ -369,7 +369,7 @@ void SkOpSpan::setOppSum(int oppSum) { this->globalState()->setWindingFailed(); return; } - SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(oppSum) <= DEBUG_LIMIT_WIND_SUM); + SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(oppSum) <= DEBUG_LIMIT_WIND_SUM); fOppSum = oppSum; } @@ -379,6 +379,6 @@ void SkOpSpan::setWindSum(int windSum) { this->globalState()->setWindingFailed(); return; } - SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(windSum) <= DEBUG_LIMIT_WIND_SUM); + SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM); fWindSum = windSum; } diff --git a/src/pathops/SkPathOpsDebug.h b/src/pathops/SkPathOpsDebug.h index ee2c291869..969a9907d5 100644 --- a/src/pathops/SkPathOpsDebug.h +++ b/src/pathops/SkPathOpsDebug.h @@ -9,6 +9,8 @@ #include "SkPathOps.h" #include "SkTypes.h" + +#include <stdlib.h> #include <stdio.h> #ifdef SK_RELEASE diff --git a/src/pathops/SkPathOpsTypes.cpp b/src/pathops/SkPathOpsTypes.cpp index c3de93a94a..bf43c14659 100644 --- a/src/pathops/SkPathOpsTypes.cpp +++ b/src/pathops/SkPathOpsTypes.cpp @@ -160,7 +160,7 @@ int UlpsDistance(float a, float b) { return a == b ? 0 : SK_MaxS32; } // Find the difference in ULPs. - return abs(floatIntA.fSignBitInt - floatIntB.fSignBitInt); + return SkTAbs(floatIntA.fSignBitInt - floatIntB.fSignBitInt); } // cube root approximation using bit hack for 64-bit float diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp index d9f925852e..6176e1c44b 100644 --- a/src/utils/SkEventTracer.cpp +++ b/src/utils/SkEventTracer.cpp @@ -9,6 +9,8 @@ #include "SkEventTracer.h" #include "SkLazyPtr.h" +#include <stdlib.h> + class SkDefaultEventTracer : public SkEventTracer { SkEventTracer::Handle addTraceEvent(char phase, diff --git a/src/utils/SkParse.cpp b/src/utils/SkParse.cpp index f6e2a438e8..446f9d444a 100644 --- a/src/utils/SkParse.cpp +++ b/src/utils/SkParse.cpp @@ -9,6 +9,8 @@ #include "SkParse.h" +#include <stdlib.h> + static inline bool is_between(int c, int min, int max) { return (unsigned)(c - min) <= (unsigned)(max - min); diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp index 20b8b43b89..5c99d2706c 100644 --- a/src/utils/SkRTConf.cpp +++ b/src/utils/SkRTConf.cpp @@ -8,6 +8,8 @@ #include "SkRTConf.h" #include "SkOSFile.h" +#include <stdlib.h> + SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) { SkFILE *fp = sk_fopen(configFileLocation(), kRead_SkFILE_Flag); |