Flutter Engine
The Flutter Engine
Functions
SkOpCubicHull.cpp File Reference
#include "src/pathops/SkPathOpsCubic.h"
#include "src/pathops/SkPathOpsPoint.h"
#include "src/pathops/SkPathOpsTypes.h"
#include <algorithm>
#include <cstddef>

Go to the source code of this file.

Functions

static bool rotate (const SkDCubic &cubic, int zero, int index, SkDCubic &rotPath)
 
static int side (double x)
 

Function Documentation

◆ rotate()

static bool rotate ( const SkDCubic cubic,
int  zero,
int  index,
SkDCubic rotPath 
)
static

Definition at line 14 of file SkOpCubicHull.cpp.

14 {
15 double dy = cubic[index].fY - cubic[zero].fY;
16 double dx = cubic[index].fX - cubic[zero].fX;
17 if (approximately_zero(dy)) {
19 return false;
20 }
21 rotPath = cubic;
22 if (dy) {
23 rotPath[index].fY = cubic[zero].fY;
24 int mask = other_two(index, zero);
25 int side1 = index ^ mask;
26 int side2 = zero ^ mask;
27 if (approximately_equal(cubic[side1].fY, cubic[zero].fY)) {
28 rotPath[side1].fY = cubic[zero].fY;
29 }
30 if (approximately_equal(cubic[side2].fY, cubic[zero].fY)) {
31 rotPath[side2].fY = cubic[zero].fY;
32 }
33 }
34 return true;
35 }
36 for (int i = 0; i < 4; ++i) {
37 rotPath[i].fX = cubic[i].fX * dx + cubic[i].fY * dy;
38 rotPath[i].fY = cubic[i].fY * dx - cubic[i].fX * dy;
39 }
40 return true;
41}
static bool approximately_zero(double x)
Definition: SkCubics.cpp:153
int other_two(int one, int two)
bool approximately_equal(double x, double y)
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
AI float cubic(float precision, const SkPoint pts[], const VectorXform &vectorXform=VectorXform())
Definition: WangsFormula.h:195

◆ side()

static int side ( double  x)
static

Definition at line 45 of file SkOpCubicHull.cpp.

45 {
46 return (x > 0) + (x >= 0);
47}
double x