| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #ifndef SkPathOps_DEFINED | 7 #ifndef SkPathOps_DEFINED |
| 8 #define SkPathOps_DEFINED | 8 #define SkPathOps_DEFINED |
| 9 | 9 |
| 10 #include "SkPreConfig.h" | 10 #include "SkPreConfig.h" |
| 11 #include "SkTArray.h" | 11 #include "SkTArray.h" |
| 12 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
| 13 | 13 |
| 14 class SkPath; | 14 class SkPath; |
| 15 struct SkRect; | 15 struct SkRect; |
| 16 | 16 |
| 17 | 17 |
| 18 // FIXME: remove this once the define in src/skia/SkUserConfig.h lands | |
| 19 #ifndef SK_SUPPORT_LEGACY_PATHOP_ENUMS | |
| 20 #define SK_SUPPORT_LEGACY_PATHOP_ENUMS | |
| 21 #endif | |
| 22 | |
| 23 // FIXME: move everything below into the SkPath class | 18 // FIXME: move everything below into the SkPath class |
| 24 /** | 19 /** |
| 25 * The logical operations that can be performed when combining two paths. | 20 * The logical operations that can be performed when combining two paths. |
| 26 */ | 21 */ |
| 27 enum SkPathOp { | 22 enum SkPathOp { |
| 28 kDifference_SkPathOp, //!< subtract the op path from the first path | 23 kDifference_SkPathOp, //!< subtract the op path from the first path |
| 29 kIntersect_SkPathOp, //!< intersect the two paths | 24 kIntersect_SkPathOp, //!< intersect the two paths |
| 30 kUnion_SkPathOp, //!< union (inclusive-or) the two paths | 25 kUnion_SkPathOp, //!< union (inclusive-or) the two paths |
| 31 kXOR_SkPathOp, //!< exclusive-or the two paths | 26 kXOR_SkPathOp, //!< exclusive-or the two paths |
| 32 kReverseDifference_SkPathOp, //!< subtract the first path from the op path | 27 kReverseDifference_SkPathOp, //!< subtract the first path from the op path |
| 33 | |
| 34 #ifdef SK_SUPPORT_LEGACY_PATHOP_ENUMS | |
| 35 kDifference_PathOp = 0, //!< subtract the op path from the first path | |
| 36 kIntersect_PathOp, //!< intersect the two paths | |
| 37 kUnion_PathOp, //!< union (inclusive-or) the two paths | |
| 38 kXOR_PathOp, //!< exclusive-or the two paths | |
| 39 kReverseDifference_PathOp, //!< subtract the first path from the op path | |
| 40 #endif | |
| 41 }; | 28 }; |
| 42 | 29 |
| 43 /** Set this path to the result of applying the Op to this path and the | 30 /** Set this path to the result of applying the Op to this path and the |
| 44 specified path: this = (this op operand). | 31 specified path: this = (this op operand). |
| 45 The resulting path will be constructed from non-overlapping contours. | 32 The resulting path will be constructed from non-overlapping contours. |
| 46 The curve order is reduced where possible so that cubics may be turned | 33 The curve order is reduced where possible so that cubics may be turned |
| 47 into quadratics, and quadratics maybe turned into lines. | 34 into quadratics, and quadratics maybe turned into lines. |
| 48 | 35 |
| 49 Returns true if operation was able to produce a result; | 36 Returns true if operation was able to produce a result; |
| 50 otherwise, result is unmodified. | 37 otherwise, result is unmodified. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bool resolve(SkPath* result); | 88 bool resolve(SkPath* result); |
| 102 | 89 |
| 103 private: | 90 private: |
| 104 SkTArray<SkPath> fPathRefs; | 91 SkTArray<SkPath> fPathRefs; |
| 105 SkTDArray<SkPathOp> fOps; | 92 SkTDArray<SkPathOp> fOps; |
| 106 | 93 |
| 107 void reset(); | 94 void reset(); |
| 108 }; | 95 }; |
| 109 | 96 |
| 110 #endif | 97 #endif |
| OLD | NEW |