| Index: Source/platform/graphics/GraphicsContext.cpp
|
| diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
|
| index 9b479b7a2bae3d42b7859d453cacbbd1e6fec725..1f353c85ad02523a01b809a50e934f507a427b03 100644
|
| --- a/Source/platform/graphics/GraphicsContext.cpp
|
| +++ b/Source/platform/graphics/GraphicsContext.cpp
|
| @@ -38,6 +38,7 @@
|
| #include "platform/text/TextRunIterator.h"
|
| #include "platform/weborigin/KURL.h"
|
| #include "third_party/skia/include/core/SkAnnotation.h"
|
| +#include "third_party/skia/include/core/SkClipStack.h"
|
| #include "third_party/skia/include/core/SkColorFilter.h"
|
| #include "third_party/skia/include/core/SkData.h"
|
| #include "third_party/skia/include/core/SkDevice.h"
|
| @@ -50,6 +51,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 +1375,43 @@ void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule)
|
| path.setFillType(previousFillType);
|
| }
|
|
|
| +bool GraphicsContext::isClipMode() const
|
| +{
|
| + if (contextDisabled())
|
| + return false;
|
| +
|
| + return m_canvas->getClipStack()->getSaveCount() != 0;
|
| +}
|
| +
|
| +Path GraphicsContext::getCurrentClipPath() const
|
| +{
|
| + 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())
|
|
|