• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 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 SkTrimImpl_DEFINED
9 #define SkTrimImpl_DEFINED
10 
11 #include "include/effects/SkTrimPathEffect.h"
12 #include "src/core/SkPathEffectBase.h"
13 
14 class SkTrimPE : public SkPathEffectBase {
15 public:
16     SkTrimPE(SkScalar startT, SkScalar stopT, SkTrimPathEffect::Mode);
17 
18 protected:
19     void flatten(SkWriteBuffer&) const override;
20     bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*,
21                       const SkMatrix&) const override;
22 
23 private:
SK_FLATTENABLE_HOOKS(SkTrimPE)24     SK_FLATTENABLE_HOOKS(SkTrimPE)
25 
26     bool computeFastBounds(SkRect* bounds) const override {
27         // Trimming a path returns a subset of the input path so just return true and leave bounds
28         // unmodified
29         return true;
30     }
31 
32     const SkScalar               fStartT,
33                                  fStopT;
34     const SkTrimPathEffect::Mode fMode;
35 
36     using INHERITED = SkPathEffectBase;
37 };
38 
39 #endif
40