SkDashImpl.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #ifndef SkDashImpl_DEFINED
  8. #define SkDashImpl_DEFINED
  9. #include "include/core/SkPathEffect.h"
  10. class SkDashImpl : public SkPathEffect {
  11. public:
  12. SkDashImpl(const SkScalar intervals[], int count, SkScalar phase);
  13. protected:
  14. ~SkDashImpl() override;
  15. void flatten(SkWriteBuffer&) const override;
  16. bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
  17. bool onAsPoints(PointData* results, const SkPath& src, const SkStrokeRec&, const SkMatrix&,
  18. const SkRect*) const override;
  19. DashType onAsADash(DashInfo* info) const override;
  20. private:
  21. SK_FLATTENABLE_HOOKS(SkDashImpl)
  22. SkScalar* fIntervals;
  23. int32_t fCount;
  24. SkScalar fPhase;
  25. // computed from phase
  26. SkScalar fInitialDashLength;
  27. int32_t fInitialDashIndex;
  28. SkScalar fIntervalLength;
  29. typedef SkPathEffect INHERITED;
  30. };
  31. #endif