Flutter Engine
The Flutter Engine
Functions
SkQuadClipper.cpp File Reference
#include "src/core/SkGeometry.h"
#include "src/core/SkQuadClipper.h"
#include <cstring>
#include <utility>

Go to the source code of this file.

Functions

static bool chopMonoQuadAt (SkScalar c0, SkScalar c1, SkScalar c2, SkScalar target, SkScalar *t)
 
static bool chopMonoQuadAtY (SkPoint pts[3], SkScalar y, SkScalar *t)
 

Function Documentation

◆ chopMonoQuadAt()

static bool chopMonoQuadAt ( SkScalar  c0,
SkScalar  c1,
SkScalar  c2,
SkScalar  target,
SkScalar t 
)
static

Definition at line 25 of file SkQuadClipper.cpp.

26 {
27 /* Solve F(t) = y where F(t) := [0](1-t)^2 + 2[1]t(1-t) + [2]t^2
28 * We solve for t, using quadratic equation, hence we have to rearrange
29 * our cooefficents to look like At^2 + Bt + C
30 */
31 SkScalar A = c0 - c1 - c1 + c2;
32 SkScalar B = 2*(c1 - c0);
33 SkScalar C = c0 - target;
34
35 SkScalar roots[2]; // we only expect one, but make room for 2 for safety
37 if (count) {
38 *t = roots[0];
39 return true;
40 }
41 return false;
42}
int count
Definition: FontMgrTest.cpp:50
int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2])
Definition: SkGeometry.cpp:95
float SkScalar
Definition: extension.cpp:12
uint32_t * target

◆ chopMonoQuadAtY()

static bool chopMonoQuadAtY ( SkPoint  pts[3],
SkScalar  y,
SkScalar t 
)
static

Definition at line 44 of file SkQuadClipper.cpp.

44 {
45 return chopMonoQuadAt(pts[0].fY, pts[1].fY, pts[2].fY, y, t);
46}
static bool chopMonoQuadAt(SkScalar c0, SkScalar c1, SkScalar c2, SkScalar target, SkScalar *t)
double y