blob: c53928ae22f6a3428dd6df1e5933c49113c63618 [file] [log] [blame]
Mike Reed76f70622017-05-23 23:00:14 -04001/*
2 * Copyright 2017 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 SkDashImpl_DEFINED
9#define SkDashImpl_DEFINED
10
11#include "SkPathEffect.h"
12
Mike Reed41232232018-03-07 17:02:47 -050013class SkDashImpl : public SkPathEffect {
Mike Reed76f70622017-05-23 23:00:14 -040014public:
15 SkDashImpl(const SkScalar intervals[], int count, SkScalar phase);
16
Mike Reed76f70622017-05-23 23:00:14 -040017#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
18 bool exposedInAndroidJavaAPI() const override { return true; }
19#endif
20
21protected:
22 ~SkDashImpl() override;
23 void flatten(SkWriteBuffer&) const override;
Mike Reed6d10f8b2018-08-16 13:22:16 -040024 bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
25
26 bool onAsPoints(PointData* results, const SkPath& src, const SkStrokeRec&, const SkMatrix&,
27 const SkRect*) const override;
28
29 DashType onAsADash(DashInfo* info) const override;
Mike Reed76f70622017-05-23 23:00:14 -040030
31private:
Mike Klein4fee3232018-10-18 17:27:16 -040032 SK_FLATTENABLE_HOOKS(SkDashImpl)
Cary Clark4dc5a452018-05-21 11:56:57 -040033
Mike Reed76f70622017-05-23 23:00:14 -040034 SkScalar* fIntervals;
35 int32_t fCount;
36 SkScalar fPhase;
37 // computed from phase
38
39 SkScalar fInitialDashLength;
40 int32_t fInitialDashIndex;
41 SkScalar fIntervalLength;
42
43 typedef SkPathEffect INHERITED;
44};
45
46#endif