Chromium Code Reviews| Index: Source/platform/graphics/GraphicsContext.cpp |
| diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp |
| index a77513527099b7b3682f774ac39d35461809701b..5d01475acd93a7a59ffb0cb7f8103a5079142925 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" |
| @@ -1377,6 +1378,34 @@ void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule) |
| path.setFillType(previousFillType); |
| } |
| +Path GraphicsContext::getCurrentClipPath(const Path& path) |
| +{ |
| + if (contextDisabled()) |
| + return Path(); |
| + |
| + const SkClipStack* clipStack = m_canvas->getClipStack(); |
| + SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart); |
| + const SkClipStack::Element* element; |
| + |
| + SkPath totalClipPath(path.skPath()); |
|
fs
2014/06/09 11:06:27
This doesn't appear to work in the general case -
zino
2014/06/10 10:09:34
Done.
|
| + |
| + 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; |
|
fs
2014/06/09 11:06:27
Since the result of this method should be the inte
zino
2014/06/10 10:09:34
Done.
|
| + else |
| + Op(totalClipPath, clipPath, (SkPathOp)element->getOp(), &totalClipPath); |
| + } |
| + |
| + return Path(totalClipPath); |
| +} |
| + |
| void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* points, bool antialiased) |
| { |
| if (contextDisabled()) |