Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions | Variables
SkPathOpsTypes.h File Reference
#include "include/core/SkPath.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "src/pathops/SkPathOpsDebug.h"
#include <cfloat>
#include <cmath>

Go to the source code of this file.

Classes

class  SkOpGlobalState
 

Macros

#define SkOPASSERT(cond)
 
#define SkOPOBJASSERT(obj, cond)
 

Enumerations

enum  SkPathOpsMask { kWinding_PathOpsMask = -1 , kNo_PathOpsMask = 0 , kEvenOdd_PathOpsMask = 1 }
 
enum class  SkOpPhase : char { kNoChange , kIntersecting , kWalking , kFixWinding }
 

Functions

bool AlmostEqualUlps (float a, float b)
 
bool AlmostEqualUlps (double a, double b)
 
bool AlmostEqualUlpsNoNormalCheck (float a, float b)
 
bool AlmostEqualUlpsNoNormalCheck (double a, double b)
 
bool AlmostEqualUlps_Pin (float a, float b)
 
bool AlmostEqualUlps_Pin (double a, double b)
 
bool AlmostDequalUlps (float a, float b)
 
bool AlmostDequalUlps (double a, double b)
 
bool NotAlmostEqualUlps (float a, float b)
 
bool NotAlmostEqualUlps (double a, double b)
 
bool NotAlmostEqualUlps_Pin (float a, float b)
 
bool NotAlmostEqualUlps_Pin (double a, double b)
 
bool NotAlmostDequalUlps (float a, float b)
 
bool NotAlmostDequalUlps (double a, double b)
 
bool AlmostBequalUlps (float a, float b)
 
bool AlmostBequalUlps (double a, double b)
 
bool AlmostPequalUlps (float a, float b)
 
bool AlmostPequalUlps (double a, double b)
 
bool RoughlyEqualUlps (float a, float b)
 
bool RoughlyEqualUlps (double a, double b)
 
bool AlmostLessUlps (float a, float b)
 
bool AlmostLessUlps (double a, double b)
 
bool AlmostLessOrEqualUlps (float a, float b)
 
bool AlmostLessOrEqualUlps (double a, double b)
 
bool AlmostBetweenUlps (float a, float b, float c)
 
bool AlmostBetweenUlps (double a, double b, double c)
 
int UlpsDistance (float a, float b)
 
int UlpsDistance (double a, double b)
 
bool zero_or_one (double x)
 
bool approximately_zero (double x)
 
bool precisely_zero (double x)
 
bool precisely_subdivide_zero (double x)
 
bool approximately_zero (float x)
 
bool approximately_zero_half (double x)
 
bool approximately_zero_double (double x)
 
bool approximately_zero_orderable (double x)
 
bool approximately_zero_squared (double x)
 
bool approximately_zero_sqrt (double x)
 
bool roughly_zero (double x)
 
bool approximately_zero_inverse (double x)
 
bool approximately_zero_when_compared_to (double x, double y)
 
bool precisely_zero_when_compared_to (double x, double y)
 
bool roughly_zero_when_compared_to (double x, double y)
 
bool approximately_equal (double x, double y)
 
bool precisely_equal (double x, double y)
 
bool precisely_subdivide_equal (double x, double y)
 
bool approximately_equal_half (double x, double y)
 
bool approximately_equal_double (double x, double y)
 
bool approximately_equal_orderable (double x, double y)
 
bool approximately_equal_squared (double x, double y)
 
bool approximately_greater (double x, double y)
 
bool approximately_greater_double (double x, double y)
 
bool approximately_greater_orderable (double x, double y)
 
bool approximately_greater_or_equal (double x, double y)
 
bool approximately_greater_or_equal_double (double x, double y)
 
bool approximately_greater_or_equal_orderable (double x, double y)
 
bool approximately_lesser (double x, double y)
 
bool approximately_lesser_double (double x, double y)
 
bool approximately_lesser_orderable (double x, double y)
 
bool approximately_lesser_or_equal (double x, double y)
 
bool approximately_lesser_or_equal_double (double x, double y)
 
bool approximately_lesser_or_equal_orderable (double x, double y)
 
bool approximately_greater_than_one (double x)
 
bool precisely_greater_than_one (double x)
 
bool approximately_less_than_zero (double x)
 
bool precisely_less_than_zero (double x)
 
bool approximately_negative (double x)
 
bool approximately_negative_orderable (double x)
 
bool precisely_negative (double x)
 
bool approximately_one_or_less (double x)
 
bool approximately_one_or_less_double (double x)
 
bool approximately_positive (double x)
 
bool approximately_positive_squared (double x)
 
bool approximately_zero_or_more (double x)
 
bool approximately_zero_or_more_double (double x)
 
bool approximately_between_orderable (double a, double b, double c)
 
bool approximately_between (double a, double b, double c)
 
bool precisely_between (double a, double b, double c)
 
bool between (double a, double b, double c)
 
bool roughly_equal (double x, double y)
 
bool roughly_negative (double x)
 
bool roughly_between (double a, double b, double c)
 
bool more_roughly_equal (double x, double y)
 
SkPath::Verb SkPathOpsPointsToVerb (int points)
 
int SkPathOpsVerbToPoints (SkPath::Verb verb)
 
double SkDInterp (double A, double B, double t)
 
int SkDSign (double x)
 
int SKDSide (double x)
 
int SkDSideBit (double x)
 
double SkPinT (double t)
 

Variables

const double FLT_EPSILON_CUBED = FLT_EPSILON * FLT_EPSILON * FLT_EPSILON
 
const double FLT_EPSILON_HALF = FLT_EPSILON / 2
 
const double FLT_EPSILON_DOUBLE = FLT_EPSILON * 2
 
const double FLT_EPSILON_ORDERABLE_ERR = FLT_EPSILON * 16
 
const double FLT_EPSILON_SQUARED = FLT_EPSILON * FLT_EPSILON
 
const double FLT_EPSILON_SQRT = 0.00034526697709225118
 
const double FLT_EPSILON_INVERSE = 1 / FLT_EPSILON
 
const double DBL_EPSILON_ERR = DBL_EPSILON * 4
 
const double DBL_EPSILON_SUBDIVIDE_ERR = DBL_EPSILON * 16
 
const double ROUGH_EPSILON = FLT_EPSILON * 64
 
const double MORE_ROUGH_EPSILON = FLT_EPSILON * 256
 
const double WAY_ROUGH_EPSILON = FLT_EPSILON * 2048
 
const double BUMP_EPSILON = FLT_EPSILON * 4096
 
const SkScalar INVERSE_NUMBER_RANGE = FLT_EPSILON_ORDERABLE_ERR
 

Macro Definition Documentation

◆ SkOPASSERT

#define SkOPASSERT (   cond)

Definition at line 228 of file SkPathOpsTypes.h.

◆ SkOPOBJASSERT

#define SkOPOBJASSERT (   obj,
  cond 
)

Definition at line 229 of file SkPathOpsTypes.h.

Enumeration Type Documentation

◆ SkOpPhase

enum class SkOpPhase : char
strong
Enumerator
kNoChange 
kIntersecting 
kWalking 
kFixWinding 

Definition at line 29 of file SkPathOpsTypes.h.

29 : char {
34};

◆ SkPathOpsMask

Enumerator
kWinding_PathOpsMask 
kNo_PathOpsMask 
kEvenOdd_PathOpsMask 

Definition at line 18 of file SkPathOpsTypes.h.

18 {
22};
@ kNo_PathOpsMask
@ kWinding_PathOpsMask
@ kEvenOdd_PathOpsMask

Function Documentation

◆ AlmostBequalUlps() [1/2]

bool AlmostBequalUlps ( double  a,
double  b 
)
inline

Definition at line 269 of file SkPathOpsTypes.h.

269 {
271}
bool AlmostBequalUlps(float a, float b)
#define SkDoubleToScalar(x)
Definition SkScalar.h:64
static bool b
struct MyStruct a[10]

◆ AlmostBequalUlps() [2/2]

bool AlmostBequalUlps ( float  a,
float  b 
)

Definition at line 113 of file SkPathOpsTypes.cpp.

113 {
114 const int UlpsEpsilon = 2;
115 return equal_ulps(a, b, UlpsEpsilon, UlpsEpsilon);
116}
static bool equal_ulps(float a, float b, int epsilon, int depsilon)

◆ AlmostBetweenUlps() [1/2]

bool AlmostBetweenUlps ( double  a,
double  b,
double  c 
)
inline

Definition at line 294 of file SkPathOpsTypes.h.

294 {
296}
bool AlmostBetweenUlps(float a, float b, float c)

◆ AlmostBetweenUlps() [2/2]

bool AlmostBetweenUlps ( float  a,
float  b,
float  c 
)

Definition at line 174 of file SkPathOpsTypes.cpp.

174 {
175 const int UlpsEpsilon = 2;
176 return a <= c ? less_or_equal_ulps(a, b, UlpsEpsilon) && less_or_equal_ulps(b, c, UlpsEpsilon)
177 : less_or_equal_ulps(b, a, UlpsEpsilon) && less_or_equal_ulps(c, b, UlpsEpsilon);
178}
static bool less_or_equal_ulps(float a, float b, int epsilon)

◆ AlmostDequalUlps() [1/2]

bool AlmostDequalUlps ( double  a,
double  b 
)

Definition at line 128 of file SkPathOpsTypes.cpp.

128 {
129 if (fabs(a) < SK_ScalarMax && fabs(b) < SK_ScalarMax) {
131 }
132 // We allow divide-by-zero here. It only happens if one of a,b is zero, and the other is NaN.
133 // (Otherwise, we'd hit the condition above). Thus, if std::max returns 0, we compute NaN / 0,
134 // which will produce NaN. The comparison will return false, which is the correct answer.
135 return sk_ieee_double_divide(fabs(a - b), std::max(fabs(a), fabs(b))) < FLT_EPSILON * 16;
136}
static constexpr double sk_ieee_double_divide(double numer, double denom)
bool AlmostDequalUlps(float a, float b)
#define SK_ScalarMax
Definition SkScalar.h:24

◆ AlmostDequalUlps() [2/2]

bool AlmostDequalUlps ( float  a,
float  b 
)

Definition at line 123 of file SkPathOpsTypes.cpp.

123 {
124 const int UlpsEpsilon = 16;
125 return d_equal_ulps(a, b, UlpsEpsilon);
126}
static bool d_equal_ulps(float a, float b, int epsilon)

◆ AlmostEqualUlps() [1/2]

bool AlmostEqualUlps ( double  a,
double  b 
)
inline

Definition at line 234 of file SkPathOpsTypes.h.

234 {
236}
bool AlmostEqualUlps(float a, float b)

◆ AlmostEqualUlps() [2/2]

bool AlmostEqualUlps ( float  a,
float  b 
)

Definition at line 138 of file SkPathOpsTypes.cpp.

138 {
139 const int UlpsEpsilon = 16;
140 return equal_ulps(a, b, UlpsEpsilon, UlpsEpsilon);
141}

◆ AlmostEqualUlps_Pin() [1/2]

bool AlmostEqualUlps_Pin ( double  a,
double  b 
)
inline

Definition at line 244 of file SkPathOpsTypes.h.

244 {
246}
bool AlmostEqualUlps_Pin(float a, float b)

◆ AlmostEqualUlps_Pin() [2/2]

bool AlmostEqualUlps_Pin ( float  a,
float  b 
)

Definition at line 148 of file SkPathOpsTypes.cpp.

148 {
149 const int UlpsEpsilon = 16;
150 return equal_ulps_pin(a, b, UlpsEpsilon, UlpsEpsilon);
151}
static bool equal_ulps_pin(float a, float b, int epsilon, int depsilon)

◆ AlmostEqualUlpsNoNormalCheck() [1/2]

bool AlmostEqualUlpsNoNormalCheck ( double  a,
double  b 
)
inline

Definition at line 239 of file SkPathOpsTypes.h.

239 {
241}
bool AlmostEqualUlpsNoNormalCheck(float a, float b)

◆ AlmostEqualUlpsNoNormalCheck() [2/2]

bool AlmostEqualUlpsNoNormalCheck ( float  a,
float  b 
)

Definition at line 143 of file SkPathOpsTypes.cpp.

143 {
144 const int UlpsEpsilon = 16;
145 return equal_ulps_no_normal_check(a, b, UlpsEpsilon, UlpsEpsilon);
146}
static bool equal_ulps_no_normal_check(float a, float b, int epsilon, int depsilon)

◆ AlmostLessOrEqualUlps() [1/2]

bool AlmostLessOrEqualUlps ( double  a,
double  b 
)
inline

Definition at line 289 of file SkPathOpsTypes.h.

289 {
291}
bool AlmostLessOrEqualUlps(float a, float b)

◆ AlmostLessOrEqualUlps() [2/2]

bool AlmostLessOrEqualUlps ( float  a,
float  b 
)

Definition at line 185 of file SkPathOpsTypes.cpp.

185 {
186 const int UlpsEpsilon = 16;
187 return less_or_equal_ulps(a, b, UlpsEpsilon);
188}

◆ AlmostLessUlps() [1/2]

bool AlmostLessUlps ( double  a,
double  b 
)
inline

Definition at line 284 of file SkPathOpsTypes.h.

284 {
286}
bool AlmostLessUlps(float a, float b)

◆ AlmostLessUlps() [2/2]

bool AlmostLessUlps ( float  a,
float  b 
)

Definition at line 180 of file SkPathOpsTypes.cpp.

180 {
181 const int UlpsEpsilon = 16;
182 return less_ulps(a, b, UlpsEpsilon);
183}
static bool less_ulps(float a, float b, int epsilon)

◆ AlmostPequalUlps() [1/2]

bool AlmostPequalUlps ( double  a,
double  b 
)
inline

Definition at line 274 of file SkPathOpsTypes.h.

274 {
276}
bool AlmostPequalUlps(float a, float b)

◆ AlmostPequalUlps() [2/2]

bool AlmostPequalUlps ( float  a,
float  b 
)

Definition at line 118 of file SkPathOpsTypes.cpp.

118 {
119 const int UlpsEpsilon = 8;
120 return equal_ulps(a, b, UlpsEpsilon, UlpsEpsilon);
121}

◆ approximately_between()

bool approximately_between ( double  a,
double  b,
double  c 
)
inline

Definition at line 519 of file SkPathOpsTypes.h.

519 {
520 return a <= c ? approximately_negative(a - b) && approximately_negative(b - c)
522}
bool approximately_negative(double x)

◆ approximately_between_orderable()

bool approximately_between_orderable ( double  a,
double  b,
double  c 
)
inline

Definition at line 513 of file SkPathOpsTypes.h.

513 {
514 return a <= c
517}
bool approximately_negative_orderable(double x)

◆ approximately_equal()

bool approximately_equal ( double  x,
double  y 
)
inline

Definition at line 385 of file SkPathOpsTypes.h.

385 {
386 return approximately_zero(x - y);
387}
bool approximately_zero(double x)
double y
double x

◆ approximately_equal_double()

bool approximately_equal_double ( double  x,
double  y 
)
inline

Definition at line 401 of file SkPathOpsTypes.h.

401 {
402 return approximately_zero_double(x - y);
403}
bool approximately_zero_double(double x)

◆ approximately_equal_half()

bool approximately_equal_half ( double  x,
double  y 
)
inline

Definition at line 397 of file SkPathOpsTypes.h.

397 {
398 return approximately_zero_half(x - y);
399}
bool approximately_zero_half(double x)

◆ approximately_equal_orderable()

bool approximately_equal_orderable ( double  x,
double  y 
)
inline

Definition at line 405 of file SkPathOpsTypes.h.

405 {
407}
bool approximately_zero_orderable(double x)

◆ approximately_equal_squared()

bool approximately_equal_squared ( double  x,
double  y 
)
inline

Definition at line 409 of file SkPathOpsTypes.h.

409 {
410 return approximately_equal(x, y);
411}
bool approximately_equal(double x, double y)

◆ approximately_greater()

bool approximately_greater ( double  x,
double  y 
)
inline

Definition at line 413 of file SkPathOpsTypes.h.

413 {
414 return x - FLT_EPSILON >= y;
415}

◆ approximately_greater_double()

bool approximately_greater_double ( double  x,
double  y 
)
inline

Definition at line 417 of file SkPathOpsTypes.h.

417 {
418 return x - FLT_EPSILON_DOUBLE >= y;
419}
const double FLT_EPSILON_DOUBLE

◆ approximately_greater_or_equal()

bool approximately_greater_or_equal ( double  x,
double  y 
)
inline

Definition at line 425 of file SkPathOpsTypes.h.

425 {
426 return x + FLT_EPSILON > y;
427}

◆ approximately_greater_or_equal_double()

bool approximately_greater_or_equal_double ( double  x,
double  y 
)
inline

Definition at line 429 of file SkPathOpsTypes.h.

429 {
430 return x + FLT_EPSILON_DOUBLE > y;
431}

◆ approximately_greater_or_equal_orderable()

bool approximately_greater_or_equal_orderable ( double  x,
double  y 
)
inline

Definition at line 433 of file SkPathOpsTypes.h.

433 {
434 return x + FLT_EPSILON_ORDERABLE_ERR > y;
435}
const double FLT_EPSILON_ORDERABLE_ERR

◆ approximately_greater_orderable()

bool approximately_greater_orderable ( double  x,
double  y 
)
inline

Definition at line 421 of file SkPathOpsTypes.h.

421 {
422 return x - FLT_EPSILON_ORDERABLE_ERR >= y;
423}

◆ approximately_greater_than_one()

bool approximately_greater_than_one ( double  x)
inline

Definition at line 461 of file SkPathOpsTypes.h.

461 {
462 return x > 1 - FLT_EPSILON;
463}

◆ approximately_less_than_zero()

bool approximately_less_than_zero ( double  x)
inline

Definition at line 469 of file SkPathOpsTypes.h.

469 {
470 return x < FLT_EPSILON;
471}

◆ approximately_lesser()

bool approximately_lesser ( double  x,
double  y 
)
inline

Definition at line 437 of file SkPathOpsTypes.h.

437 {
438 return x + FLT_EPSILON <= y;
439}

◆ approximately_lesser_double()

bool approximately_lesser_double ( double  x,
double  y 
)
inline

Definition at line 441 of file SkPathOpsTypes.h.

441 {
442 return x + FLT_EPSILON_DOUBLE <= y;
443}

◆ approximately_lesser_or_equal()

bool approximately_lesser_or_equal ( double  x,
double  y 
)
inline

Definition at line 449 of file SkPathOpsTypes.h.

449 {
450 return x - FLT_EPSILON < y;
451}

◆ approximately_lesser_or_equal_double()

bool approximately_lesser_or_equal_double ( double  x,
double  y 
)
inline

Definition at line 453 of file SkPathOpsTypes.h.

453 {
454 return x - FLT_EPSILON_DOUBLE < y;
455}

◆ approximately_lesser_or_equal_orderable()

bool approximately_lesser_or_equal_orderable ( double  x,
double  y 
)
inline

Definition at line 457 of file SkPathOpsTypes.h.

457 {
458 return x - FLT_EPSILON_ORDERABLE_ERR < y;
459}

◆ approximately_lesser_orderable()

bool approximately_lesser_orderable ( double  x,
double  y 
)
inline

Definition at line 445 of file SkPathOpsTypes.h.

445 {
446 return x + FLT_EPSILON_ORDERABLE_ERR <= y;
447}

◆ approximately_negative()

bool approximately_negative ( double  x)
inline

Definition at line 477 of file SkPathOpsTypes.h.

477 {
478 return x < FLT_EPSILON;
479}

◆ approximately_negative_orderable()

bool approximately_negative_orderable ( double  x)
inline

Definition at line 481 of file SkPathOpsTypes.h.

481 {
483}

◆ approximately_one_or_less()

bool approximately_one_or_less ( double  x)
inline

Definition at line 489 of file SkPathOpsTypes.h.

489 {
490 return x < 1 + FLT_EPSILON;
491}

◆ approximately_one_or_less_double()

bool approximately_one_or_less_double ( double  x)
inline

Definition at line 493 of file SkPathOpsTypes.h.

493 {
494 return x < 1 + FLT_EPSILON_DOUBLE;
495}

◆ approximately_positive()

bool approximately_positive ( double  x)
inline

Definition at line 497 of file SkPathOpsTypes.h.

497 {
498 return x > -FLT_EPSILON;
499}

◆ approximately_positive_squared()

bool approximately_positive_squared ( double  x)
inline

Definition at line 501 of file SkPathOpsTypes.h.

501 {
502 return x > -(FLT_EPSILON_SQUARED);
503}
const double FLT_EPSILON_SQUARED

◆ approximately_zero() [1/2]

bool approximately_zero ( double  x)
inline

Definition at line 327 of file SkPathOpsTypes.h.

327 {
328 return fabs(x) < FLT_EPSILON;
329}

◆ approximately_zero() [2/2]

bool approximately_zero ( float  x)
inline

Definition at line 339 of file SkPathOpsTypes.h.

339 {
340 return fabs(x) < FLT_EPSILON;
341}

◆ approximately_zero_double()

bool approximately_zero_double ( double  x)
inline

Definition at line 347 of file SkPathOpsTypes.h.

347 {
348 return fabs(x) < FLT_EPSILON_DOUBLE;
349}

◆ approximately_zero_half()

bool approximately_zero_half ( double  x)
inline

Definition at line 343 of file SkPathOpsTypes.h.

343 {
344 return fabs(x) < FLT_EPSILON_HALF;
345}
const double FLT_EPSILON_HALF

◆ approximately_zero_inverse()

bool approximately_zero_inverse ( double  x)
inline

Definition at line 367 of file SkPathOpsTypes.h.

367 {
368 return fabs(x) > FLT_EPSILON_INVERSE;
369}
const double FLT_EPSILON_INVERSE

◆ approximately_zero_or_more()

bool approximately_zero_or_more ( double  x)
inline

Definition at line 505 of file SkPathOpsTypes.h.

505 {
506 return x > -FLT_EPSILON;
507}

◆ approximately_zero_or_more_double()

bool approximately_zero_or_more_double ( double  x)
inline

Definition at line 509 of file SkPathOpsTypes.h.

509 {
510 return x > -FLT_EPSILON_DOUBLE;
511}

◆ approximately_zero_orderable()

bool approximately_zero_orderable ( double  x)
inline

Definition at line 351 of file SkPathOpsTypes.h.

351 {
352 return fabs(x) < FLT_EPSILON_ORDERABLE_ERR;
353}

◆ approximately_zero_sqrt()

bool approximately_zero_sqrt ( double  x)
inline

Definition at line 359 of file SkPathOpsTypes.h.

359 {
360 return fabs(x) < FLT_EPSILON_SQRT;
361}
const double FLT_EPSILON_SQRT

◆ approximately_zero_squared()

bool approximately_zero_squared ( double  x)
inline

Definition at line 355 of file SkPathOpsTypes.h.

355 {
356 return fabs(x) < FLT_EPSILON_SQUARED;
357}

◆ approximately_zero_when_compared_to()

bool approximately_zero_when_compared_to ( double  x,
double  y 
)
inline

Definition at line 371 of file SkPathOpsTypes.h.

371 {
372 return x == 0 || fabs(x) < fabs(y * FLT_EPSILON);
373}

◆ between()

bool between ( double  a,
double  b,
double  c 
)
inline

Definition at line 530 of file SkPathOpsTypes.h.

530 {
531 SkASSERT(((a <= b && b <= c) || (a >= b && b >= c)) == ((a - b) * (c - b) <= 0)
533 return (a - b) * (c - b) <= 0;
534}
#define SkASSERT(cond)
Definition SkAssert.h:116
bool precisely_zero(double x)

◆ more_roughly_equal()

bool more_roughly_equal ( double  x,
double  y 
)
inline

Definition at line 549 of file SkPathOpsTypes.h.

549 {
550 return fabs(x - y) < MORE_ROUGH_EPSILON;
551}
const double MORE_ROUGH_EPSILON

◆ NotAlmostDequalUlps() [1/2]

bool NotAlmostDequalUlps ( double  a,
double  b 
)
inline

Definition at line 263 of file SkPathOpsTypes.h.

263 {
265}
bool NotAlmostDequalUlps(float a, float b)

◆ NotAlmostDequalUlps() [2/2]

bool NotAlmostDequalUlps ( float  a,
float  b 
)

Definition at line 163 of file SkPathOpsTypes.cpp.

163 {
164 const int UlpsEpsilon = 16;
165 return d_not_equal_ulps(a, b, UlpsEpsilon);
166}
static bool d_not_equal_ulps(float a, float b, int epsilon)

◆ NotAlmostEqualUlps() [1/2]

bool NotAlmostEqualUlps ( double  a,
double  b 
)
inline

Definition at line 253 of file SkPathOpsTypes.h.

253 {
255}
bool NotAlmostEqualUlps(float a, float b)

◆ NotAlmostEqualUlps() [2/2]

bool NotAlmostEqualUlps ( float  a,
float  b 
)

Definition at line 153 of file SkPathOpsTypes.cpp.

153 {
154 const int UlpsEpsilon = 16;
155 return not_equal_ulps(a, b, UlpsEpsilon);
156}
static bool not_equal_ulps(float a, float b, int epsilon)

◆ NotAlmostEqualUlps_Pin() [1/2]

bool NotAlmostEqualUlps_Pin ( double  a,
double  b 
)
inline

Definition at line 258 of file SkPathOpsTypes.h.

258 {
260}
bool NotAlmostEqualUlps_Pin(float a, float b)

◆ NotAlmostEqualUlps_Pin() [2/2]

bool NotAlmostEqualUlps_Pin ( float  a,
float  b 
)

Definition at line 158 of file SkPathOpsTypes.cpp.

158 {
159 const int UlpsEpsilon = 16;
160 return not_equal_ulps_pin(a, b, UlpsEpsilon);
161}
static bool not_equal_ulps_pin(float a, float b, int epsilon)

◆ precisely_between()

bool precisely_between ( double  a,
double  b,
double  c 
)
inline

Definition at line 524 of file SkPathOpsTypes.h.

524 {
525 return a <= c ? precisely_negative(a - b) && precisely_negative(b - c)
527}
bool precisely_negative(double x)

◆ precisely_equal()

bool precisely_equal ( double  x,
double  y 
)
inline

Definition at line 389 of file SkPathOpsTypes.h.

389 {
390 return precisely_zero(x - y);
391}

◆ precisely_greater_than_one()

bool precisely_greater_than_one ( double  x)
inline

Definition at line 465 of file SkPathOpsTypes.h.

465 {
466 return x > 1 - DBL_EPSILON_ERR;
467}
const double DBL_EPSILON_ERR

◆ precisely_less_than_zero()

bool precisely_less_than_zero ( double  x)
inline

Definition at line 473 of file SkPathOpsTypes.h.

473 {
474 return x < DBL_EPSILON_ERR;
475}

◆ precisely_negative()

bool precisely_negative ( double  x)
inline

Definition at line 485 of file SkPathOpsTypes.h.

485 {
486 return x < DBL_EPSILON_ERR;
487}

◆ precisely_subdivide_equal()

bool precisely_subdivide_equal ( double  x,
double  y 
)
inline

Definition at line 393 of file SkPathOpsTypes.h.

393 {
394 return precisely_subdivide_zero(x - y);
395}
bool precisely_subdivide_zero(double x)

◆ precisely_subdivide_zero()

bool precisely_subdivide_zero ( double  x)
inline

Definition at line 335 of file SkPathOpsTypes.h.

335 {
336 return fabs(x) < DBL_EPSILON_SUBDIVIDE_ERR;
337}
const double DBL_EPSILON_SUBDIVIDE_ERR

◆ precisely_zero()

bool precisely_zero ( double  x)
inline

Definition at line 331 of file SkPathOpsTypes.h.

331 {
332 return fabs(x) < DBL_EPSILON_ERR;
333}

◆ precisely_zero_when_compared_to()

bool precisely_zero_when_compared_to ( double  x,
double  y 
)
inline

Definition at line 375 of file SkPathOpsTypes.h.

375 {
376 return x == 0 || fabs(x) < fabs(y * DBL_EPSILON);
377}

◆ roughly_between()

bool roughly_between ( double  a,
double  b,
double  c 
)
inline

Definition at line 544 of file SkPathOpsTypes.h.

544 {
545 return a <= c ? roughly_negative(a - b) && roughly_negative(b - c)
547}
bool roughly_negative(double x)

◆ roughly_equal()

bool roughly_equal ( double  x,
double  y 
)
inline

Definition at line 536 of file SkPathOpsTypes.h.

536 {
537 return fabs(x - y) < ROUGH_EPSILON;
538}
const double ROUGH_EPSILON

◆ roughly_negative()

bool roughly_negative ( double  x)
inline

Definition at line 540 of file SkPathOpsTypes.h.

540 {
541 return x < ROUGH_EPSILON;
542}

◆ roughly_zero()

bool roughly_zero ( double  x)
inline

Definition at line 363 of file SkPathOpsTypes.h.

363 {
364 return fabs(x) < ROUGH_EPSILON;
365}

◆ roughly_zero_when_compared_to()

bool roughly_zero_when_compared_to ( double  x,
double  y 
)
inline

Definition at line 379 of file SkPathOpsTypes.h.

379 {
380 return x == 0 || fabs(x) < fabs(y * ROUGH_EPSILON);
381}

◆ RoughlyEqualUlps() [1/2]

bool RoughlyEqualUlps ( double  a,
double  b 
)
inline

Definition at line 279 of file SkPathOpsTypes.h.

279 {
281}
bool RoughlyEqualUlps(float a, float b)

◆ RoughlyEqualUlps() [2/2]

bool RoughlyEqualUlps ( float  a,
float  b 
)

Definition at line 168 of file SkPathOpsTypes.cpp.

168 {
169 const int UlpsEpsilon = 256;
170 const int DUlpsEpsilon = 1024;
171 return equal_ulps(a, b, UlpsEpsilon, DUlpsEpsilon);
172}

◆ SkDInterp()

double SkDInterp ( double  A,
double  B,
double  t 
)
inline

Definition at line 581 of file SkPathOpsTypes.h.

581 {
582 return A + (B - A) * t;
583}

◆ SKDSide()

int SKDSide ( double  x)
inline

Definition at line 593 of file SkPathOpsTypes.h.

593 {
594 return (x > 0) + (x >= 0);
595}

◆ SkDSideBit()

int SkDSideBit ( double  x)
inline

Definition at line 599 of file SkPathOpsTypes.h.

599 {
600 return 1 << SKDSide(x);
601}
int SKDSide(double x)

◆ SkDSign()

int SkDSign ( double  x)
inline

Definition at line 587 of file SkPathOpsTypes.h.

587 {
588 return (x > 0) - (x < 0);
589}

◆ SkPathOpsPointsToVerb()

SkPath::Verb SkPathOpsPointsToVerb ( int  points)
inline

Definition at line 553 of file SkPathOpsTypes.h.

553 {
554 int verb = (1 << points) >> 1;
555#ifdef SK_DEBUG
556 switch (points) {
557 case 0: SkASSERT(SkPath::kMove_Verb == verb); break;
558 case 1: SkASSERT(SkPath::kLine_Verb == verb); break;
559 case 2: SkASSERT(SkPath::kQuad_Verb == verb); break;
560 case 3: SkASSERT(SkPath::kCubic_Verb == verb); break;
561 default: SkDEBUGFAIL("should not be here");
562 }
563#endif
564 return (SkPath::Verb)verb;
565}
static const int points[]
#define SkDEBUGFAIL(message)
Definition SkAssert.h:118
@ kMove_Verb
Definition SkPath.h:1458
@ kCubic_Verb
Definition SkPath.h:1462
@ kQuad_Verb
Definition SkPath.h:1460
@ kLine_Verb
Definition SkPath.h:1459

◆ SkPathOpsVerbToPoints()

int SkPathOpsVerbToPoints ( SkPath::Verb  verb)
inline

Definition at line 567 of file SkPathOpsTypes.h.

567 {
568 int points = (int) verb - (((int) verb + 1) >> 2);
569#ifdef SK_DEBUG
570 switch (verb) {
571 case SkPath::kLine_Verb: SkASSERT(1 == points); break;
572 case SkPath::kQuad_Verb: SkASSERT(2 == points); break;
573 case SkPath::kConic_Verb: SkASSERT(2 == points); break;
574 case SkPath::kCubic_Verb: SkASSERT(3 == points); break;
575 default: SkDEBUGFAIL("should not get here");
576 }
577#endif
578 return points;
579}
Type::kYUV Type::kRGBA() int(0.7 *637)
@ kConic_Verb
Definition SkPath.h:1461

◆ SkPinT()

double SkPinT ( double  t)
inline

Definition at line 603 of file SkPathOpsTypes.h.

603 {
604 return precisely_less_than_zero(t) ? 0 : precisely_greater_than_one(t) ? 1 : t;
605}
bool precisely_less_than_zero(double x)
bool precisely_greater_than_one(double x)

◆ UlpsDistance() [1/2]

int UlpsDistance ( double  a,
double  b 
)
inline

Definition at line 299 of file SkPathOpsTypes.h.

299 {
301}
int UlpsDistance(float a, float b)

◆ UlpsDistance() [2/2]

int UlpsDistance ( float  a,
float  b 
)

Definition at line 190 of file SkPathOpsTypes.cpp.

190 {
191 int32_t floatIntA, floatIntB;
192 memcpy(&floatIntA, &a, sizeof(int32_t));
193 memcpy(&floatIntB, &b, sizeof(int32_t));
194 // Different signs means they do not match.
195 if ((floatIntA < 0) != (floatIntB < 0)) {
196 // Check for equality to make sure +0 == -0
197 return a == b ? 0 : SK_MaxS32;
198 }
199 // Find the difference in ULPs.
200 return SkTAbs(floatIntA - floatIntB);
201}
static constexpr int32_t SK_MaxS32
Definition SkMath.h:21
static T SkTAbs(T value)
Definition SkTemplates.h:43

◆ zero_or_one()

bool zero_or_one ( double  x)
inline

Definition at line 323 of file SkPathOpsTypes.h.

323 {
324 return x == 0 || x == 1;
325}

Variable Documentation

◆ BUMP_EPSILON

const double BUMP_EPSILON = FLT_EPSILON * 4096

Definition at line 319 of file SkPathOpsTypes.h.

◆ DBL_EPSILON_ERR

const double DBL_EPSILON_ERR = DBL_EPSILON * 4

Definition at line 314 of file SkPathOpsTypes.h.

◆ DBL_EPSILON_SUBDIVIDE_ERR

const double DBL_EPSILON_SUBDIVIDE_ERR = DBL_EPSILON * 16

Definition at line 315 of file SkPathOpsTypes.h.

◆ FLT_EPSILON_CUBED

const double FLT_EPSILON_CUBED = FLT_EPSILON * FLT_EPSILON * FLT_EPSILON

Definition at line 305 of file SkPathOpsTypes.h.

◆ FLT_EPSILON_DOUBLE

const double FLT_EPSILON_DOUBLE = FLT_EPSILON * 2

Definition at line 307 of file SkPathOpsTypes.h.

◆ FLT_EPSILON_HALF

const double FLT_EPSILON_HALF = FLT_EPSILON / 2

Definition at line 306 of file SkPathOpsTypes.h.

◆ FLT_EPSILON_INVERSE

const double FLT_EPSILON_INVERSE = 1 / FLT_EPSILON

Definition at line 313 of file SkPathOpsTypes.h.

◆ FLT_EPSILON_ORDERABLE_ERR

const double FLT_EPSILON_ORDERABLE_ERR = FLT_EPSILON * 16

Definition at line 308 of file SkPathOpsTypes.h.

◆ FLT_EPSILON_SQRT

const double FLT_EPSILON_SQRT = 0.00034526697709225118

Definition at line 312 of file SkPathOpsTypes.h.

◆ FLT_EPSILON_SQUARED

const double FLT_EPSILON_SQUARED = FLT_EPSILON * FLT_EPSILON

Definition at line 309 of file SkPathOpsTypes.h.

◆ INVERSE_NUMBER_RANGE

const SkScalar INVERSE_NUMBER_RANGE = FLT_EPSILON_ORDERABLE_ERR

Definition at line 321 of file SkPathOpsTypes.h.

◆ MORE_ROUGH_EPSILON

const double MORE_ROUGH_EPSILON = FLT_EPSILON * 256

Definition at line 317 of file SkPathOpsTypes.h.

◆ ROUGH_EPSILON

const double ROUGH_EPSILON = FLT_EPSILON * 64

Definition at line 316 of file SkPathOpsTypes.h.

◆ WAY_ROUGH_EPSILON

const double WAY_ROUGH_EPSILON = FLT_EPSILON * 2048

Definition at line 318 of file SkPathOpsTypes.h.