1 | /* |
---|---|
2 | * Copyright 2017 Google Inc. |
3 | * |
4 | * Use of this source code is governed by a BSD-style license that can be |
5 | * found in the LICENSE file. |
6 | */ |
7 | |
8 | #include "modules/sksg/include/SkSGGeometryNode.h" |
9 | |
10 | #include "include/core/SkPath.h" |
11 | |
12 | namespace sksg { |
13 | |
14 | // Geometry nodes don't generate damage on their own, but via their aggregation ancestor Draw nodes. |
15 | GeometryNode::GeometryNode() : INHERITED(kBubbleDamage_Trait) {} |
16 | |
17 | void GeometryNode::clip(SkCanvas* canvas, bool aa) const { |
18 | SkASSERT(!this->hasInval()); |
19 | this->onClip(canvas, aa); |
20 | } |
21 | |
22 | void GeometryNode::draw(SkCanvas* canvas, const SkPaint& paint) const { |
23 | SkASSERT(!this->hasInval()); |
24 | this->onDraw(canvas, paint); |
25 | } |
26 | |
27 | bool GeometryNode::contains(const SkPoint& p) const { |
28 | SkASSERT(!this->hasInval()); |
29 | return this->bounds().contains(p.x(), p.y()) ? this->onContains(p) : false; |
30 | } |
31 | |
32 | SkPath GeometryNode::asPath() const { |
33 | SkASSERT(!this->hasInval()); |
34 | return this->onAsPath(); |
35 | } |
36 | |
37 | } // namespace sksg |
38 |