Flutter Engine
The Flutter Engine
Classes | Macros | Functions
Sk1DPathEffect.cpp File Reference
#include "include/effects/Sk1DPathEffect.h"
#include "include/core/SkFlattenable.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathEffect.h"
#include "include/core/SkPathMeasure.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkStrokeRec.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkFloatingPoint.h"
#include "src/core/SkPathEffectBase.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"

Go to the source code of this file.

Classes

class  Sk1DPathEffect
 
class  SkPath1DPathEffectImpl
 

Macros

#define MAX_REASONABLE_ITERATIONS   100000
 

Functions

static bool morphpoints (SkPoint dst[], const SkPoint src[], int count, SkPathMeasure &meas, SkScalar dist)
 
static void morphpath (SkPath *dst, const SkPath &src, SkPathMeasure &meas, SkScalar dist)
 

Macro Definition Documentation

◆ MAX_REASONABLE_ITERATIONS

#define MAX_REASONABLE_ITERATIONS   100000

Definition at line 29 of file Sk1DPathEffect.cpp.

Function Documentation

◆ morphpath()

static void morphpath ( SkPath dst,
const SkPath src,
SkPathMeasure meas,
SkScalar  dist 
)
static

Definition at line 178 of file Sk1DPathEffect.cpp.

179 {
180 SkPath::Iter iter(src, false);
181 SkPoint srcP[4], dstP[3];
182 SkPath::Verb verb;
183
184 while ((verb = iter.next(srcP)) != SkPath::kDone_Verb) {
185 switch (verb) {
187 if (morphpoints(dstP, srcP, 1, meas, dist)) {
188 dst->moveTo(dstP[0]);
189 }
190 break;
192 srcP[2] = srcP[1];
193 srcP[1].set(SkScalarAve(srcP[0].fX, srcP[2].fX),
194 SkScalarAve(srcP[0].fY, srcP[2].fY));
195 [[fallthrough]];
197 if (morphpoints(dstP, &srcP[1], 2, meas, dist)) {
198 dst->quadTo(dstP[0], dstP[1]);
199 }
200 break;
202 if (morphpoints(dstP, &srcP[1], 2, meas, dist)) {
203 dst->conicTo(dstP[0], dstP[1], iter.conicWeight());
204 }
205 break;
207 if (morphpoints(dstP, &srcP[1], 3, meas, dist)) {
208 dst->cubicTo(dstP[0], dstP[1], dstP[2]);
209 }
210 break;
212 dst->close();
213 break;
214 default:
215 SkDEBUGFAIL("unknown verb");
216 break;
217 }
218 }
219}
static bool morphpoints(SkPoint dst[], const SkPoint src[], int count, SkPathMeasure &meas, SkScalar dist)
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
#define SkScalarAve(a, b)
Definition: SkScalar.h:74
@ kClose_Verb
Definition: SkPath.h:1471
@ kMove_Verb
Definition: SkPath.h:1466
@ kConic_Verb
Definition: SkPath.h:1469
@ kDone_Verb
Definition: SkPath.h:1472
@ kCubic_Verb
Definition: SkPath.h:1470
@ kQuad_Verb
Definition: SkPath.h:1468
@ kLine_Verb
Definition: SkPath.h:1467
dst
Definition: cp.py:12
void set(float x, float y)
Definition: SkPoint_impl.h:200

◆ morphpoints()

static bool morphpoints ( SkPoint  dst[],
const SkPoint  src[],
int  count,
SkPathMeasure meas,
SkScalar  dist 
)
static

Definition at line 147 of file Sk1DPathEffect.cpp.

148 {
149 for (int i = 0; i < count; i++) {
150 SkPoint pos;
151 SkVector tangent;
152
153 SkScalar sx = src[i].fX;
154 SkScalar sy = src[i].fY;
155
156 if (!meas.getPosTan(dist + sx, &pos, &tangent)) {
157 return false;
158 }
159
161 SkPoint pt;
162
163 pt.set(sx, sy);
164 matrix.setSinCos(tangent.fY, tangent.fX, 0, 0);
165 matrix.preTranslate(-sx, 0);
166 matrix.postTranslate(pos.fX, pos.fY);
167 matrix.mapPoints(&dst[i], &pt, 1);
168 }
169 return true;
170}
int count
Definition: FontMgrTest.cpp:50
SkPoint pos
bool getPosTan(SkScalar distance, SkPoint *position, SkVector *tangent)
float SkScalar
Definition: extension.cpp:12
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165