From fb03cc7b49b1b90eafc761425e3ac8348a0e159f Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Tue, 11 Aug 2009 19:54:35 +0000 Subject: [PATCH] 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 --- src/core/SkPath.cpp | 15 ++++++++++----- 1 file 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); + } } } -- 2.34.1