Fixing bounding box computation for inverse filled paths in SkBBoxRecord
authorjunov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 17 Dec 2012 21:30:51 +0000 (21:30 +0000)
committerjunov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 17 Dec 2012 21:30:51 +0000 (21:30 +0000)
BUG=http://code.google.com/p/skia/issues/detail?id=1014
TEST=gm emptypath with --tileGrid
Review URL: https://codereview.appspot.com/6944062

git-svn-id: http://skia.googlecode.com/svn/trunk@6865 2bbb7eff-a529-9590-31e7-b0007b416f81

src/core/SkBBoxRecord.cpp

index 432d4adba4b3143e84a9afbb5208158c50bbca9d..cc18c7af25d8462075d8dc4b5a82306636548235 100644 (file)
@@ -27,7 +27,15 @@ void SkBBoxRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
 }
 
 void SkBBoxRecord::drawPath(const SkPath& path, const SkPaint& paint) {
-    if (this->transformBounds(path.getBounds(), &paint)) {
+    if (path.isInverseFillType()) {
+        // If path is inverse filled, use the current clip bounds as the
+        // path's device-space bounding box.
+        SkIRect clipBounds;
+        if (this->getClipDeviceBounds(&clipBounds)) {
+            this->handleBBox(SkRect::MakeFromIRect(clipBounds));
+            INHERITED::drawPath(path, paint);
+        }
+    } else if (this->transformBounds(path.getBounds(), &paint)) {
         INHERITED::drawPath(path, paint);
     }
 }