Flutter Engine
The Flutter Engine
SkDashPathPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 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 SkDashPathPriv_DEFINED
9#define SkDashPathPriv_DEFINED
10
12
13namespace SkDashPath {
14 /**
15 * Calculates the initialDashLength, initialDashIndex, and intervalLength based on the
16 * inputed phase and intervals. If adjustedPhase is passed in, then the phase will be
17 * adjusted to be between 0 and intervalLength. The result will be stored in adjustedPhase.
18 * If adjustedPhase is nullptr then it is assumed phase is already between 0 and intervalLength
19 *
20 * Caller should have already used ValidDashPath to exclude invalid data.
21 */
22 void CalcDashParameters(SkScalar phase, const SkScalar intervals[], int32_t count,
23 SkScalar* initialDashLength, int32_t* initialDashIndex,
24 SkScalar* intervalLength, SkScalar* adjustedPhase = nullptr);
25
26 bool FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*,
28
29#ifdef SK_BUILD_FOR_FUZZER
30 const SkScalar kMaxDashCount = 10000;
31#else
32 const SkScalar kMaxDashCount = 1000000;
33#endif
34
35 /** See comments for InternalFilter */
38 kAllow,
39 };
40
41 /**
42 * Caller should have already used ValidDashPath to exclude invalid data. Typically, this leaves
43 * the strokeRec unmodified. However, for some simple shapes (e.g. a line) it may directly
44 * evaluate the dash and stroke to produce a stroked output path with a fill strokeRec. Passing
45 * true for disallowStrokeRecApplication turns this behavior off.
46 */
47 bool InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec,
48 const SkRect* cullRect, const SkScalar aIntervals[],
49 int32_t count, SkScalar initialDashLength, int32_t initialDashIndex,
50 SkScalar intervalLength, SkScalar startPhase,
52
53 bool ValidDashPath(SkScalar phase, const SkScalar intervals[], int32_t count);
54} // namespace SkDashPath
55
56#endif
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
int count
Definition: FontMgrTest.cpp:50
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
const SkScalar kMaxDashCount
bool FilterDashPath(SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *, const SkPathEffect::DashInfo &info)
Definition: SkDashPath.cpp:462
bool InternalFilter(SkPath *dst, const SkPath &src, SkStrokeRec *rec, const SkRect *cullRect, const SkScalar aIntervals[], int32_t count, SkScalar initialDashLength, int32_t initialDashIndex, SkScalar intervalLength, SkScalar startPhase, StrokeRecApplication=StrokeRecApplication::kAllow)
Definition: SkDashPath.cpp:309
void CalcDashParameters(SkScalar phase, const SkScalar intervals[], int32_t count, SkScalar *initialDashLength, int32_t *initialDashIndex, SkScalar *intervalLength, SkScalar *adjustedPhase=nullptr)
Definition: SkDashPath.cpp:54
bool ValidDashPath(SkScalar phase, const SkScalar intervals[], int32_t count)
Definition: SkDashPath.cpp:476
dst
Definition: cp.py:12