• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
13 class SK_API SkDashImpl : public SkPathEffect {
14 public:
15     SkDashImpl(const SkScalar intervals[], int count, SkScalar phase);
16 
17     bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
18 
19     bool asPoints(PointData* results, const SkPath& src, const SkStrokeRec&, const SkMatrix&,
20                   const SkRect*) const override;
21 
22     DashType asADash(DashInfo* info) const override;
23 
24     SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDashImpl)25     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDashImpl)
26 
27 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
28     bool exposedInAndroidJavaAPI() const override { return true; }
29 #endif
30 
31 protected:
32     ~SkDashImpl() override;
33     void flatten(SkWriteBuffer&) const override;
34 
35 private:
36     SkScalar*   fIntervals;
37     int32_t     fCount;
38     SkScalar    fPhase;
39     // computed from phase
40 
41     SkScalar    fInitialDashLength;
42     int32_t     fInitialDashIndex;
43     SkScalar    fIntervalLength;
44 
45     typedef SkPathEffect INHERITED;
46 };
47 
48 #endif
49