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>
This commit is contained in:
Ben Wagner 2016-11-09 15:00:49 -05:00 committed by Skia Commit-Bot
parent b87642e018
commit 8a1036caf1
3 changed files with 10 additions and 7 deletions

View File

@ -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() {

View File

@ -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;
}

View File

@ -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];