test (and fix) clip_restriction in canvas
BUG=skia:
Change-Id: I86d25d0fd82be35d01471fba59f77b360be5373c
Reviewed-on: https://skia-review.googlesource.com/9995
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index 6f9eb6b..090297d 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -62,43 +62,35 @@
void SkConservativeClip::op(const SkRect& localRect, const SkMatrix& ctm, const SkIRect& devBounds,
SkRegion::Op op, bool doAA) {
- SkRect devRect;
-
- SkIRect bounds(devBounds);
- this->applyClipRestriction(op, &bounds);
SkIRect ir;
switch (mutate_conservative_op(&op, false)) {
case kDoNothing_MutateResult:
return;
case kReplaceClippedAgainstGlobalBounds_MutateResult:
- ir = bounds;
+ ir = devBounds;
break;
- case kContinue_MutateResult:
+ case kContinue_MutateResult: {
+ SkRect devRect;
ctm.mapRect(&devRect, localRect);
ir = doAA ? devRect.roundOut() : devRect.round();
- break;
+ } break;
}
this->op(ir, op);
}
void SkConservativeClip::op(const SkRRect& rrect, const SkMatrix& ctm, const SkIRect& devBounds,
SkRegion::Op op, bool doAA) {
- SkIRect bounds(devBounds);
- this->applyClipRestriction(op, &bounds);
- this->op(rrect.getBounds(), ctm, bounds, op, doAA);
+ this->op(rrect.getBounds(), ctm, devBounds, op, doAA);
}
void SkConservativeClip::op(const SkPath& path, const SkMatrix& ctm, const SkIRect& devBounds,
SkRegion::Op op, bool doAA) {
- SkIRect bounds(devBounds);
- this->applyClipRestriction(op, &bounds);
-
SkIRect ir;
switch (mutate_conservative_op(&op, path.isInverseFillType())) {
case kDoNothing_MutateResult:
return;
case kReplaceClippedAgainstGlobalBounds_MutateResult:
- ir = bounds;
+ ir = devBounds;
break;
case kContinue_MutateResult: {
SkRect bounds = path.getBounds();
@@ -129,6 +121,7 @@
SkRegion result;
result.op(SkRegion(fBounds), SkRegion(devRect), op);
fBounds = result.getBounds();
+ this->applyClipRestriction(op, &fBounds);
}
///////////////////////////////////////////////////////////////////////////////////////////////////