aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCanvas.cpp
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2015-02-04 07:39:34 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-04 07:39:34 -0800
commit1a481fe4bf632ed4f76cb337691236fabfd4ab03 (patch)
tree1dbb47d73d8565084c6edb664b75e986bcf8f4a2 /src/core/SkCanvas.cpp
parentb9d4d279cd381392e69c6638457055264696f7eb (diff)
[SkSVGDevice] Initial clipping support
Implement SVG clips based on clip stack flattening - which is now exposed in SkClipStack::asPath() and shared with SkCanvas's simplify-clip code. R=reed@google.com,mtklein@google.com Review URL: https://codereview.chromium.org/876923003
Diffstat (limited to 'src/core/SkCanvas.cpp')
-rw-r--r--src/core/SkCanvas.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 5b37e08b30..56cfb8d652 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1446,30 +1446,11 @@ void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edg
fClipStack.clipDevPath(devPath, op, kSoft_ClipEdgeStyle == edgeStyle);
if (fAllowSimplifyClip) {
- devPath.reset();
- devPath.setFillType(SkPath::kInverseEvenOdd_FillType);
- const SkClipStack* clipStack = getClipStack();
- SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart);
- const SkClipStack::Element* element;
- while ((element = iter.next())) {
- SkClipStack::Element::Type type = element->getType();
- SkPath operand;
- if (type != SkClipStack::Element::kEmpty_Type) {
- element->asPath(&operand);
- }
- SkRegion::Op elementOp = element->getOp();
- if (elementOp == SkRegion::kReplace_Op) {
- devPath = operand;
- } else {
- Op(devPath, operand, (SkPathOp) elementOp, &devPath);
- }
- // if the prev and curr clips disagree about aa -vs- not, favor the aa request.
- // perhaps we need an API change to avoid this sort of mixed-signals about
- // clipping.
- if (element->isAA()) {
- edgeStyle = kSoft_ClipEdgeStyle;
- }
+ bool clipIsAA = getClipStack()->asPath(&devPath);
+ if (clipIsAA) {
+ edgeStyle = kSoft_ClipEdgeStyle;
}
+
op = SkRegion::kReplace_Op;
}