aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGNode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/svg/model/SkSVGNode.cpp')
-rw-r--r--experimental/svg/model/SkSVGNode.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/experimental/svg/model/SkSVGNode.cpp b/experimental/svg/model/SkSVGNode.cpp
index ec452ec9c6..0f3743ffd2 100644
--- a/experimental/svg/model/SkSVGNode.cpp
+++ b/experimental/svg/model/SkSVGNode.cpp
@@ -7,6 +7,7 @@
#include "SkCanvas.h"
#include "SkMatrix.h"
+#include "SkPathOps.h"
#include "SkSVGNode.h"
#include "SkSVGRenderContext.h"
#include "SkSVGValue.h"
@@ -32,7 +33,18 @@ bool SkSVGNode::asPaint(const SkSVGRenderContext& ctx, SkPaint* paint) const {
SkPath SkSVGNode::asPath(const SkSVGRenderContext& ctx) const {
SkSVGRenderContext localContext(ctx);
- return this->onPrepareToRender(&localContext) ? this->onAsPath(localContext) : SkPath();
+ if (!this->onPrepareToRender(&localContext)) {
+ return SkPath();
+ }
+
+ SkPath path = this->onAsPath(localContext);
+
+ if (const auto* clipPath = localContext.clipPath()) {
+ // There is a clip-path present on the current node.
+ Op(path, *clipPath, kIntersect_SkPathOp, &path);
+ }
+
+ return path;
}
bool SkSVGNode::onPrepareToRender(SkSVGRenderContext* ctx) const {