aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPath.cpp
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-08-11 19:54:35 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-08-11 19:54:35 +0000
commitfb03cc7b49b1b90eafc761425e3ac8348a0e159f (patch)
tree724cdf90436eae36e74fa069d922f0d278cd3c1a /src/core/SkPath.cpp
parent558434a9e129904595cf5161097b843c681a05c7 (diff)
fix validate() to note that an empty path can (by side-effect) have an empty but
translated fBounds git-svn-id: http://skia.googlecode.com/svn/trunk@314 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPath.cpp')
-rw-r--r--src/core/SkPath.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 794681c81e..63c3eb06fa 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1233,11 +1233,16 @@ void SkPath::validate() const {
if (!fBoundsIsDirty) {
SkRect bounds;
compute_pt_bounds(&bounds, fPts);
- // can't call contains(), since it returns false if the rect is empty
- SkASSERT(fBounds.fLeft <= bounds.fLeft);
- SkASSERT(fBounds.fTop <= bounds.fTop);
- SkASSERT(fBounds.fRight >= bounds.fRight);
- SkASSERT(fBounds.fBottom >= bounds.fBottom);
+ if (fPts.count() <= 1) {
+ // if we're empty, fBounds may be empty but translated, so we can't
+ // necessarily compare to bounds directly
+ // try path.addOval(2, 2, 2, 2) which is empty, but the bounds will
+ // be [2, 2, 2, 2]
+ SkASSERT(bounds.isEmpty());
+ SkASSERT(fBounds.isEmpty());
+ } else {
+ fBounds.contains(bounds);
+ }
}
}