diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-26 19:51:16 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-26 19:51:16 +0000 |
commit | 66560ca776773858abfffd59974eac32c942acc3 (patch) | |
tree | 16902f88fd485608a6d7310c634d154d17ee2f4b /include/pathops | |
parent | 0cc99cf793d2de0523461a2cef1af2a62f4a1695 (diff) |
path ops -- handle non-finite numbers
Op() and Simplify() do nothing if the input
is non-finite. Add code and tests.
Review URL: https://codereview.chromium.org/14407006
git-svn-id: http://skia.googlecode.com/svn/trunk@8882 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/pathops')
-rw-r--r-- | include/pathops/SkPathOps.h | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/include/pathops/SkPathOps.h b/include/pathops/SkPathOps.h index 285118673f..ba602749e0 100644 --- a/include/pathops/SkPathOps.h +++ b/include/pathops/SkPathOps.h @@ -21,19 +21,35 @@ enum SkPathOp { kReverseDifference_PathOp, //!< subtract the first path from the op path }; -/** - * Set this path to the result of applying the Op to this path and the - * specified path: this = (this op operand). The resulting path will be constructed - * from non-overlapping contours. The curve order is reduced where possible so that cubics may - * be turned into quadratics, and quadratics maybe turned into lines. +/** Set this path to the result of applying the Op to this path and the + specified path: this = (this op operand). + The resulting path will be constructed from non-overlapping contours. + The curve order is reduced where possible so that cubics may be turned + into quadratics, and quadratics maybe turned into lines. + + Returns true if operation was able to produce a result; + otherwise, result is unmodified. + + @param one The first operand (for difference, the minuend) + @param two The second operand (for difference, the subtrahend) + @param result The product of the operands. The result may be one of the + inputs. + @return True if operation succeeded. */ -void Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result); +bool Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result); -/** - * Set this path to a set of non-overlapping contours that describe the same - * area as the original path. The curve order is reduced where possible so that cubics may - * be turned into quadratics, and quadratics maybe turned into lines. +/** Set this path to a set of non-overlapping contours that describe the + same area as the original path. + The curve order is reduced where possible so that cubics may + be turned into quadratics, and quadratics maybe turned into lines. + + Returns true if operation was able to produce a result; + otherwise, result is unmodified. + + @param path The path to simplify. + @param result The simplified path. The result may be the input. + @return True if simplification succeeded. */ -void Simplify(const SkPath& path, SkPath* result); +bool Simplify(const SkPath& path, SkPath* result); #endif |