Fixing clip region test in deferred canvas, used to determine whether a draw operation occludes the entire canvas.
BUG=http://code.google.com/p/chromium/issues/detail?id=164580
TEST=unit test DeferredCanvas/TestDeferredCanvasFreshFrame
Review URL: https://codereview.appspot.com/6934045
git-svn-id: http://skia.googlecode.com/svn/trunk@6780 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index b0033df..a1e32bc 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -684,25 +684,8 @@
}
}
- switch (canvas->getClipType()) {
- case SkCanvas::kRect_ClipType :
- {
- SkIRect bounds;
- canvas->getClipDeviceBounds(&bounds);
- if (bounds.fLeft > 0 || bounds.fTop > 0 ||
- bounds.fRight < canvasSize.fWidth ||
- bounds.fBottom < canvasSize.fHeight)
- return false;
- }
- break;
- case SkCanvas::kComplex_ClipType :
- return false; // conservative
- case SkCanvas::kEmpty_ClipType:
- default:
- break;
- };
-
- return true;
+ return this->getClipStack()->quickContains(SkRect::MakeXYWH(0, 0,
+ SkIntToScalar(canvasSize.fWidth), SkIntToScalar(canvasSize.fHeight)));
}
int SkDeferredCanvas::save(SaveFlags flags) {