Include what you use with signbit.

Include cmath in a few source files which use signbit and a relying on
magic to happen to use it.

Also Fix nuttiness in SampleClip. No need to #define single character
identifiers.

Change-Id: Iae3352d0cab9aaa6c37d6424f064b3d86fa2e011
Reviewed-on: https://skia-review.googlesource.com/4626
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp
index 06bd717..984a6e5 100644
--- a/samplecode/SampleClip.cpp
+++ b/samplecode/SampleClip.cpp
@@ -6,6 +6,7 @@
  */
 
 #include "SampleCode.h"
+#include "SkAAClip.h"
 #include "SkView.h"
 #include "SkCanvas.h"
 #include "SkColorPriv.h"
@@ -13,8 +14,8 @@
 #include "SkPath.h"
 #include "SkRandom.h"
 
-#define W   150
-#define H   200
+constexpr int W = 150;
+constexpr int H = 200;
 
 static void show_text(SkCanvas* canvas, bool doAA) {
     SkRandom rand;
@@ -101,8 +102,6 @@
 
 typedef void (*CanvasProc)(SkCanvas*, bool);
 
-#include "SkAAClip.h"
-
 class ClipView : public SampleView {
 public:
     ClipView() {
diff --git a/src/effects/gradients/Sk4fLinearGradient.cpp b/src/effects/gradients/Sk4fLinearGradient.cpp
index 3aebdfa..29d9088 100644
--- a/src/effects/gradients/Sk4fLinearGradient.cpp
+++ b/src/effects/gradients/Sk4fLinearGradient.cpp
@@ -9,6 +9,8 @@
 #include "Sk4x4f.h"
 #include "SkXfermode.h"
 
+#include <cmath>
+
 namespace {
 
 template<DstType dstType, ApplyPremul premul>
@@ -117,7 +119,7 @@
     : INHERITED(shader, rec) {
 
     // Our fast path expects interval points to be monotonically increasing in x.
-    const bool reverseIntervals = this->isFast() && signbit(fDstToPos.getScaleX());
+    const bool reverseIntervals = this->isFast() && std::signbit(fDstToPos.getScaleX());
     this->buildIntervals(shader, rec, reverseIntervals);
 
     SkASSERT(fIntervals.count() > 0);
@@ -315,7 +317,7 @@
 
     SkScalar currentAdvance() const {
         SkASSERT(fAdvX >= 0);
-        SkASSERT(fAdvX <= (fInterval->fP1 - fInterval->fP0) / fDx || !isfinite(fAdvX));
+        SkASSERT(fAdvX <= (fInterval->fP1 - fInterval->fP0) / fDx || !std::isfinite(fAdvX));
         return fAdvX;
     }
 
diff --git a/tests/Float16Test.cpp b/tests/Float16Test.cpp
index 9983568..64873c3 100644
--- a/tests/Float16Test.cpp
+++ b/tests/Float16Test.cpp
@@ -14,6 +14,8 @@
 #include "SkPM4f.h"
 #include "SkRandom.h"
 
+#include <cmath>
+
 static bool eq_within_half_float(float a, float b) {
     const float kTolerance = 1.0f / (1 << (8 + 10));
 
@@ -100,7 +102,7 @@
         uint16_t alternate = expected;
         if (is_denorm(expected)) {
             // _finite_ftz() may flush denorms to zero, and happens to keep the sign bit.
-            alternate = signbit(f) ? 0x8000 : 0x0000;
+            alternate = std::signbit(f) ? 0x8000 : 0x0000;
         }
 
         uint16_t actual = SkFloatToHalf_finite_ftz(Sk4f{f})[0];