diff options
author | 2015-02-04 07:39:34 -0800 | |
---|---|---|
committer | 2015-02-04 07:39:34 -0800 | |
commit | 1a481fe4bf632ed4f76cb337691236fabfd4ab03 (patch) | |
tree | 1dbb47d73d8565084c6edb664b75e986bcf8f4a2 /src/core/SkCanvas.cpp | |
parent | b9d4d279cd381392e69c6638457055264696f7eb (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.cpp | 27 |
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; } |