Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkDLineIntersection.cpp File Reference
#include "include/core/SkTypes.h"
#include "src/pathops/SkIntersections.h"
#include "src/pathops/SkPathOpsLine.h"
#include "src/pathops/SkPathOpsPoint.h"
#include "src/pathops/SkPathOpsTypes.h"
#include <cmath>
#include <cstdint>
#include <utility>

Go to the source code of this file.

Functions

static int horizontal_coincident (const SkDLine &line, double y)
 
static int vertical_coincident (const SkDLine &line, double x)
 

Function Documentation

◆ horizontal_coincident()

static int horizontal_coincident ( const SkDLine line,
double  y 
)
static

Definition at line 188 of file SkDLineIntersection.cpp.

188 {
189 double min = line[0].fY;
190 double max = line[1].fY;
191 if (min > max) {
192 using std::swap;
193 swap(min, max);
194 }
195 if (min > y || max < y) {
196 return 0;
197 }
198 if (AlmostEqualUlps(min, max) && max - min < fabs(line[0].fX - line[1].fX)) {
199 return 2;
200 }
201 return 1;
202}
bool AlmostEqualUlps(const SkPoint &pt1, const SkPoint &pt2)
void swap(sk_sp< T > &a, sk_sp< T > &b)
Definition SkRefCnt.h:341
static float max(float r, float g, float b)
Definition hsl.cpp:49
static float min(float r, float g, float b)
Definition hsl.cpp:48
double y

◆ vertical_coincident()

static int vertical_coincident ( const SkDLine line,
double  x 
)
static

Definition at line 266 of file SkDLineIntersection.cpp.

266 {
267 double min = line[0].fX;
268 double max = line[1].fX;
269 if (min > max) {
270 using std::swap;
271 swap(min, max);
272 }
273 if (!precisely_between(min, x, max)) {
274 return 0;
275 }
276 if (AlmostEqualUlps(min, max)) {
277 return 2;
278 }
279 return 1;
280}
bool precisely_between(double a, double b, double c)
double x