xref: /aosp_15_r20/external/skia/modules/sksg/src/SkSGGeometryNode.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #include "include/core/SkPoint.h"
12 #include "include/core/SkRect.h"
13 #include "include/private/base/SkAssert.h"
14 
15 namespace sksg {
16 
17 // Geometry nodes don't generate damage on their own, but via their aggregation ancestor Draw nodes.
GeometryNode()18 GeometryNode::GeometryNode() : INHERITED(kBubbleDamage_Trait) {}
19 
clip(SkCanvas * canvas,bool aa) const20 void GeometryNode::clip(SkCanvas* canvas, bool aa) const {
21     SkASSERT(!this->hasInval());
22     this->onClip(canvas, aa);
23 }
24 
draw(SkCanvas * canvas,const SkPaint & paint) const25 void GeometryNode::draw(SkCanvas* canvas, const SkPaint& paint) const {
26     SkASSERT(!this->hasInval());
27     this->onDraw(canvas, paint);
28 }
29 
contains(const SkPoint & p) const30 bool GeometryNode::contains(const SkPoint& p) const {
31     SkASSERT(!this->hasInval());
32     return this->bounds().contains(p.x(), p.y()) ? this->onContains(p) : false;
33 }
34 
asPath() const35 SkPath GeometryNode::asPath() const {
36     SkASSERT(!this->hasInval());
37     return this->onAsPath();
38 }
39 
40 } // namespace sksg
41