SkOpPE.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #ifndef SkOpPE_DEFINED
  8. #define SkOpPE_DEFINED
  9. #include "include/effects/SkOpPathEffect.h"
  10. class SkOpPE : public SkPathEffect {
  11. public:
  12. SkOpPE(sk_sp<SkPathEffect> one, sk_sp<SkPathEffect> two, SkPathOp op);
  13. protected:
  14. void flatten(SkWriteBuffer&) const override;
  15. bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
  16. private:
  17. SK_FLATTENABLE_HOOKS(SkOpPE)
  18. sk_sp<SkPathEffect> fOne;
  19. sk_sp<SkPathEffect> fTwo;
  20. SkPathOp fOp;
  21. typedef SkPathEffect INHERITED;
  22. };
  23. class SkMatrixPE : public SkPathEffect {
  24. public:
  25. SkMatrixPE(const SkMatrix&);
  26. protected:
  27. void flatten(SkWriteBuffer&) const override;
  28. bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
  29. private:
  30. SK_FLATTENABLE_HOOKS(SkMatrixPE)
  31. SkMatrix fMatrix;
  32. typedef SkPathEffect INHERITED;
  33. };
  34. class SkStrokePE : public SkPathEffect {
  35. public:
  36. SkStrokePE(SkScalar width, SkPaint::Join, SkPaint::Cap, SkScalar miter);
  37. protected:
  38. void flatten(SkWriteBuffer&) const override;
  39. bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
  40. // TODO: override onComputeFastBounds (I think)
  41. private:
  42. SK_FLATTENABLE_HOOKS(SkStrokePE)
  43. SkScalar fWidth,
  44. fMiter;
  45. SkPaint::Join fJoin;
  46. SkPaint::Cap fCap;
  47. typedef SkPathEffect INHERITED;
  48. };
  49. #endif