36 , fInitialDashLength(-1)
37 , fInitialDashIndex(0)
38 , fIntervalLength(0) {
44 for (
int i = 0; i <
count; i++) {
45 fIntervals[i] = intervals[i];
50 &fInitialDashLength, &fInitialDashIndex, &fIntervalLength, &fPhase);
60 fInitialDashLength, fInitialDashIndex, fIntervalLength,
72 rect->outset(radius, radius);
81 if (
nullptr == cullRect) {
89 if ((dx && dy) || (!dx && !dy)) {
105 inv.mapRect(&bounds);
118 if (maxX <= bounds.fLeft || minX >= bounds.fRight) {
126 if (minX < bounds.fLeft) {
127 minX = bounds.fLeft -
SkScalarMod(bounds.fLeft - minX, intervalLength);
129 if (maxX > bounds.fRight) {
130 maxX = bounds.fRight +
SkScalarMod(maxX - bounds.fRight, intervalLength);
151 if (maxY <= bounds.fTop || minY >= bounds.fBottom) {
159 if (minY < bounds.fTop) {
160 minY = bounds.fTop -
SkScalarMod(bounds.fTop - minY, intervalLength);
162 if (maxY > bounds.fBottom) {
163 maxY = bounds.fBottom +
SkScalarMod(maxY - bounds.fBottom, intervalLength);
203 if (!src.isLine(pts)) {
213 if (!matrix.rectStaysRect()) {
218 if (!
cull_line(pts, rec, matrix, cullRect, fIntervalLength)) {
247 SkScalar clampedInitialDashLength = std::min(
length, fInitialDashLength);
250 results->
fFlags |= PointData::kCircles_PointFlag;
255 if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) {
256 SkASSERT(len2 >= clampedInitialDashLength);
257 if (0 == fInitialDashIndex) {
258 if (clampedInitialDashLength > 0) {
259 if (clampedInitialDashLength >= fIntervals[0]) {
262 len2 -= clampedInitialDashLength;
264 len2 -= fIntervals[1];
269 len2 -= clampedInitialDashLength;
275 SkScalar numIntervals = len2 / fIntervalLength;
281 len2 -= numMidPoints * fIntervalLength;
282 bool partialLast =
false;
284 if (len2 < fIntervals[0]) {
297 if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) {
300 if (0 == fInitialDashIndex) {
301 if (clampedInitialDashLength > 0) {
314 if (clampedInitialDashLength < fIntervals[0]) {
317 x + halfWidth,
y + halfHeight);
319 SkASSERT(curPt < results->fNumPoints);
324 distance += clampedInitialDashLength;
327 distance += fIntervals[1];
329 distance += clampedInitialDashLength;
333 if (0 != numMidPoints) {
336 for (
int i = 0; i < numMidPoints; ++i) {
340 SkASSERT(curPt < results->fNumPoints);
344 distance += fIntervalLength;
366 x + halfWidth,
y + halfHeight);
377 if (
info->fCount >= fCount &&
info->fIntervals) {
378 memcpy(
info->fIntervals, fIntervals, fCount *
sizeof(
SkScalar));
380 info->fCount = fCount;
381 info->fPhase = fPhase;
387 buffer.writeScalar(fPhase);
388 buffer.writeScalarArray(fIntervals, fCount);
401 if (
buffer.readScalarArray(intervals.get(),
count)) {
static SkM44 inv(const SkM44 &m)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr bool SkIsAlign2(T x)
static void outset_for_stroke(SkRect *rect, const SkStrokeRec &rec)
static bool cull_line(SkPoint *pts, const SkStrokeRec &rec, const SkMatrix &ctm, const SkRect *cullRect, const SkScalar intervalLength)
static bool SkIsFinite(T x, Pack... values)
SK_API void sk_free(void *)
static void * sk_malloc_throw(size_t size)
#define SkScalarInvert(x)
#define SkScalarMod(x, y)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
static bool SkScalarIsInt(SkScalar x)
#define SkScalarFloorToInt(x)
constexpr int SkToInt(S x)
SkDashImpl(const SkScalar intervals[], int count, SkScalar phase)
void flatten(SkWriteBuffer &) const override
DashType onAsADash(DashInfo *info) const override
bool onAsPoints(PointData *results, const SkPath &src, const SkStrokeRec &, const SkMatrix &, const SkRect *) const override
bool onFilterPath(SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *, const SkMatrix &) const override
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
bool invert(SkMatrix *inverse) const
bool rectStaysRect() const
@ kButt_Cap
no stroke extension
@ kMiter_Join
extends to miter limit
@ kDash_DashType
fills in all of the info parameter
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
SkScalar getWidth() const
SkPaint::Join getJoin() const
SkPaint::Cap getCap() const
SkScalar getMiter() const
static const uint8_t buffer[]
const SkScalar kMaxDashCount
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)
void CalcDashParameters(SkScalar phase, const SkScalar intervals[], int32_t count, SkScalar *initialDashLength, int32_t *initialDashIndex, SkScalar *intervalLength, SkScalar *adjustedPhase=nullptr)
bool ValidDashPath(SkScalar phase, const SkScalar intervals[], int32_t count)
static void swap(TArray< T, M > &a, TArray< T, M > &b)
void set(float x, float y)
static float Distance(const SkPoint &a, const SkPoint &b)
void scale(float scale, SkPoint *dst) const
constexpr float y() const
constexpr float x() const