aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2016-11-09 15:00:49 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-09 20:29:45 +0000
commit8a1036caf1231286923112f0bcffb12ac2257b41 (patch)
tree829f41aa4025908add959e64d53e80c02f90a9d6
parentb87642e0186cfd43a196627234743b0f81ffc65f (diff)
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>
-rw-r--r--samplecode/SampleClip.cpp7
-rw-r--r--src/effects/gradients/Sk4fLinearGradient.cpp6
-rw-r--r--tests/Float16Test.cpp4
3 files changed, 10 insertions, 7 deletions
diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp
index 06bd717ece..984a6e5ba5 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 @@ static void show_thick(SkCanvas* canvas, bool doAA) {
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 3aebdfa49d..29d9088425 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 @@ LinearGradient4fContext::LinearGradient4fContext(const SkLinearGradient& shader,
: 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 @@ public:
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 99835686fa..64873c3fc8 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 @@ DEF_TEST(SkFloatToHalf_finite_ftz, r) {
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];