Index: Source/platform/graphics/GraphicsContext.cpp |
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp |
index b1e34caf093615323edccf25486fdb917ac6c834..7e1592b0fdf930e63606b58a052f45fe85217c61 100644 |
--- a/Source/platform/graphics/GraphicsContext.cpp |
+++ b/Source/platform/graphics/GraphicsContext.cpp |
@@ -49,6 +49,7 @@ |
#include "third_party/skia/include/effects/SkLumaColorFilter.h" |
#include "third_party/skia/include/gpu/GrRenderTarget.h" |
#include "third_party/skia/include/gpu/GrTexture.h" |
+#include "third_party/skia/include/pathops/SkPathOps.h" |
#include "wtf/Assertions.h" |
#include "wtf/MathExtras.h" |
@@ -1373,6 +1374,35 @@ void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule) |
path.setFillType(previousFillType); |
} |
+Path GraphicsContext::getCurrentClipPath() |
+{ |
+ if (contextDisabled()) |
+ return Path(); |
+ |
+ const SkClipStack* clipStack = m_canvas->getClipStack(); |
+ SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart); |
+ const SkClipStack::Element* element; |
+ |
+ SkPath totalClipPath; |
+ totalClipPath.setFillType(SkPath::kInverseEvenOdd_FillType); |
+ |
+ while ((element = iter.next())) { |
+ |
+ SkClipStack::Element::Type type = element->getType(); |
+ SkPath clipPath; |
+ if (type != SkClipStack::Element::kEmpty_Type) |
+ element->asPath(&clipPath); |
+ |
+ SkRegion::Op elementOp = element->getOp(); |
+ if (elementOp == SkRegion::kReplace_Op) |
+ totalClipPath = clipPath; |
+ else |
+ Op(totalClipPath, clipPath, (SkPathOp)elementOp, &totalClipPath); |
+ } |
+ |
+ return Path(totalClipPath); |
+} |
+ |
void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* points, bool antialiased) |
{ |
if (contextDisabled()) |