Home | History | Annotate | Download | only in effects
      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 SkDashImpl : public SkPathEffect {
     14 public:
     15     SkDashImpl(const SkScalar intervals[], int count, SkScalar phase);
     16 
     17 protected:
     18     ~SkDashImpl() override;
     19     void flatten(SkWriteBuffer&) const override;
     20     bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
     21 
     22     bool onAsPoints(PointData* results, const SkPath& src, const SkStrokeRec&, const SkMatrix&,
     23                     const SkRect*) const override;
     24 
     25     DashType onAsADash(DashInfo* info) const override;
     26 
     27 private:
     28     SK_FLATTENABLE_HOOKS(SkDashImpl)
     29 
     30     SkScalar*   fIntervals;
     31     int32_t     fCount;
     32     SkScalar    fPhase;
     33     // computed from phase
     34 
     35     SkScalar    fInitialDashLength;
     36     int32_t     fInitialDashIndex;
     37     SkScalar    fIntervalLength;
     38 
     39     typedef SkPathEffect INHERITED;
     40 };
     41 
     42 #endif
     43