Flutter Engine
The Flutter Engine
third_party
skia
include
core
SkCubicMap.h
Go to the documentation of this file.
1
/*
2
* Copyright 2018 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#ifndef SkCubicMap_DEFINED
9
#define SkCubicMap_DEFINED
10
11
#include "
include/core/SkPoint.h
"
12
#include "
include/core/SkScalar.h
"
13
#include "
include/core/SkTypes.h
"
14
15
/**
16
* Fast evaluation of a cubic ease-in / ease-out curve. This is defined as a parametric cubic
17
* curve inside the unit square.
18
*
19
* pt[0] is implicitly { 0, 0 }
20
* pt[3] is implicitly { 1, 1 }
21
* pts[1,2].X are inside the unit [0..1]
22
*/
23
class
SK_API
SkCubicMap
{
24
public
:
25
SkCubicMap
(
SkPoint
p1,
SkPoint
p2);
26
27
static
bool
IsLinear
(
SkPoint
p1,
SkPoint
p2) {
28
return
SkScalarNearlyEqual
(p1.
fX
, p1.
fY
) &&
SkScalarNearlyEqual
(p2.
fX
, p2.
fY
);
29
}
30
31
float
computeYFromX(
float
x
)
const
;
32
33
SkPoint
computeFromT(
float
t)
const
;
34
35
private
:
36
enum
Type
{
37
kLine_Type,
// x == y
38
kCubeRoot_Type,
// At^3 == x
39
kSolver_Type,
// general monotonic cubic solver
40
};
41
42
SkPoint
fCoeff[3];
43
Type
fType;
44
};
45
46
#endif
47
SK_API
#define SK_API
Definition:
SkAPI.h:35
SkPoint.h
SkScalar.h
SkScalarNearlyEqual
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
Definition:
SkScalar.h:107
SkTypes.h
SkCubicMap
Definition:
SkCubicMap.h:23
SkCubicMap::IsLinear
static bool IsLinear(SkPoint p1, SkPoint p2)
Definition:
SkCubicMap.h:27
x
double x
Definition:
mouse-input-test.cc:82
Type
Definition:
asyncrescaleandread.cpp:530
SkPoint
Definition:
SkPoint_impl.h:163
SkPoint::fX
float fX
x-axis value
Definition:
SkPoint_impl.h:164
SkPoint::fY
float fY
y-axis value
Definition:
SkPoint_impl.h:165
Generated on Sun Jun 23 2024 21:56:02 for Flutter Engine by
1.9.4