Flutter Engine
The Flutter Engine
Functions
SkQuads.cpp File Reference
#include "src/base/SkQuads.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkFloatingPoint.h"
#include <cmath>
#include <limits>

Go to the source code of this file.

Functions

static int solve_linear (const double M, const double B, double solution[2])
 
static bool close_to_linear (double A, double B)
 
static double zero_if_tiny (double x)
 

Function Documentation

◆ close_to_linear()

static bool close_to_linear ( double  A,
double  B 
)
static

Definition at line 37 of file SkQuads.cpp.

37 {
38 if (A != 0) {
39 // Return if B is much bigger than A.
40 return std::abs(B / A) >= 1.0e+16;
41 }
42
43 // Otherwise A is zero, and the quadratic is linear.
44 return true;
45}
SIN Vec< N, float > abs(const Vec< N, float > &x)
Definition: SkVx.h:707

◆ solve_linear()

static int solve_linear ( const double  M,
const double  B,
double  solution[2] 
)
static

Definition at line 18 of file SkQuads.cpp.

18 {
20 solution[0] = 0;
22 return 1;
23 }
24 return 0;
25 }
26 solution[0] = -B / M;
27 if (!std::isfinite(solution[0])) {
28 return 0;
29 }
30 return 1;
31}
bool sk_double_nearly_zero(double a)
SINT bool isfinite(const Vec< N, T > &v)
Definition: SkVx.h:1003
#define M(PROC, DITHER)

◆ zero_if_tiny()

static double zero_if_tiny ( double  x)
static

Definition at line 131 of file SkQuads.cpp.

131 {
132 return sk_double_nearly_zero(x) ? 0 : x;
133}
double x