blob: c1bf4621bce3d7c33d1f2e6265ac9c542715fe38 [file] [log] [blame]
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkDashImpl_DEFINED
#define SkDashImpl_DEFINED
#include "SkPathEffect.h"
class SkDashImpl : public SkPathEffect {
public:
SkDashImpl(const SkScalar intervals[], int count, SkScalar phase);
Factory getFactory() const override { return CreateProc; }
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
bool exposedInAndroidJavaAPI() const override { return true; }
#endif
protected:
~SkDashImpl() override;
void flatten(SkWriteBuffer&) const override;
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
bool onAsPoints(PointData* results, const SkPath& src, const SkStrokeRec&, const SkMatrix&,
const SkRect*) const override;
DashType onAsADash(DashInfo* info) const override;
private:
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
friend class SkFlattenable::PrivateInitializer;
SkScalar* fIntervals;
int32_t fCount;
SkScalar fPhase;
// computed from phase
SkScalar fInitialDashLength;
int32_t fInitialDashIndex;
SkScalar fIntervalLength;
typedef SkPathEffect INHERITED;
};
#endif