}
bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
- SkIRect* intersection, const SkImageFilter* imageFilter) {
+ SkIRect* intersection, const SkImageFilter* imageFilter) {
SkIRect clipBounds;
SkRegion::Op op = SkRegion::kIntersect_Op;
if (!this->getClipDeviceBounds(&clipBounds)) {
// early exit if the layer's bounds are clipped out
if (!ir.intersect(clipBounds)) {
if (bounds_affects_clip(flags)) {
+ fCachedLocalClipBoundsDirty = true;
fMCRec->fRasterClip.setEmpty();
}
return false;
}
if (bounds_affects_clip(flags)) {
+ fCachedLocalClipBoundsDirty = true;
fClipStack->clipDevRect(ir, op);
// early exit if the clip is now empty
if (!fMCRec->fRasterClip.op(ir, op)) {
REPORTER_ASSERT(reporter, 0xFFFFFFFF == *dst.getAddr32(5, 5));
}
+static void test_layers(skiatest::Reporter* reporter) {
+ SkCanvas canvas(100, 100);
+
+ SkRect r = SkRect::MakeWH(10, 10);
+ REPORTER_ASSERT(reporter, false == canvas.quickReject(r));
+
+ r.offset(300, 300);
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r));
+
+ // Test that saveLayer updates quickReject
+ SkRect bounds = SkRect::MakeLTRB(50, 50, 70, 70);
+ canvas.saveLayer(&bounds, NULL);
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(SkRect::MakeWH(10, 10)));
+ REPORTER_ASSERT(reporter, false == canvas.quickReject(SkRect::MakeWH(60, 60)));
+}
+
DEF_TEST(QuickReject, reporter) {
test_drawBitmap(reporter);
+ test_layers(reporter);
}