| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2009 The Android Open Source Project | 3 * Copyright 2009 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkEdgeClipper_DEFINED | 10 #ifndef SkEdgeClipper_DEFINED |
| 11 #define SkEdgeClipper_DEFINED | 11 #define SkEdgeClipper_DEFINED |
| 12 | 12 |
| 13 #include "SkPath.h" | 13 #include "SkPath.h" |
| 14 | 14 |
| 15 /** This is basically an iterator. It is initialized with an edge and a clip, | 15 /** This is basically an iterator. It is initialized with an edge and a clip, |
| 16 and then next() is called until it returns kDone_Verb. | 16 and then next() is called until it returns kDone_Verb. |
| 17 */ | 17 */ |
| 18 class SkEdgeClipper { | 18 class SkEdgeClipper { |
| 19 public: | 19 public: |
| 20 SkEdgeClipper(bool canCullToTheRight) : fCanCullToTheRight(canCullToTheRight
) {} |
| 21 |
| 20 bool clipQuad(const SkPoint pts[3], const SkRect& clip); | 22 bool clipQuad(const SkPoint pts[3], const SkRect& clip); |
| 21 bool clipCubic(const SkPoint pts[4], const SkRect& clip); | 23 bool clipCubic(const SkPoint pts[4], const SkRect& clip); |
| 22 | 24 |
| 23 SkPath::Verb next(SkPoint pts[]); | 25 SkPath::Verb next(SkPoint pts[]); |
| 24 | 26 |
| 27 bool canCullToTheRight() const { return fCanCullToTheRight; } |
| 28 |
| 25 private: | 29 private: |
| 26 SkPoint* fCurrPoint; | 30 SkPoint* fCurrPoint; |
| 27 SkPath::Verb* fCurrVerb; | 31 SkPath::Verb* fCurrVerb; |
| 32 const bool fCanCullToTheRight; |
| 28 | 33 |
| 29 enum { | 34 enum { |
| 30 kMaxVerbs = 13, | 35 kMaxVerbs = 13, |
| 31 kMaxPoints = 32 | 36 kMaxPoints = 32 |
| 32 }; | 37 }; |
| 33 SkPoint fPoints[kMaxPoints]; | 38 SkPoint fPoints[kMaxPoints]; |
| 34 SkPath::Verb fVerbs[kMaxVerbs]; | 39 SkPath::Verb fVerbs[kMaxVerbs]; |
| 35 | 40 |
| 36 void clipMonoQuad(const SkPoint srcPts[3], const SkRect& clip); | 41 void clipMonoQuad(const SkPoint srcPts[3], const SkRect& clip); |
| 37 void clipMonoCubic(const SkPoint srcPts[4], const SkRect& clip); | 42 void clipMonoCubic(const SkPoint srcPts[4], const SkRect& clip); |
| 38 void appendVLine(SkScalar x, SkScalar y0, SkScalar y1, bool reverse); | 43 void appendVLine(SkScalar x, SkScalar y0, SkScalar y1, bool reverse); |
| 39 void appendQuad(const SkPoint pts[3], bool reverse); | 44 void appendQuad(const SkPoint pts[3], bool reverse); |
| 40 void appendCubic(const SkPoint pts[4], bool reverse); | 45 void appendCubic(const SkPoint pts[4], bool reverse); |
| 41 }; | 46 }; |
| 42 | 47 |
| 43 #ifdef SK_DEBUG | 48 #ifdef SK_DEBUG |
| 44 void sk_assert_monotonic_x(const SkPoint pts[], int count); | 49 void sk_assert_monotonic_x(const SkPoint pts[], int count); |
| 45 void sk_assert_monotonic_y(const SkPoint pts[], int count); | 50 void sk_assert_monotonic_y(const SkPoint pts[], int count); |
| 46 #else | 51 #else |
| 47 #define sk_assert_monotonic_x(pts, count) | 52 #define sk_assert_monotonic_x(pts, count) |
| 48 #define sk_assert_monotonic_y(pts, count) | 53 #define sk_assert_monotonic_y(pts, count) |
| 49 #endif | 54 #endif |
| 50 | 55 |
| 51 #endif | 56 #endif |
| OLD | NEW |