• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "SkSGGeometryNode.h"
9 
10 #include "SkPath.h"
11 
12 namespace sksg {
13 
14 // Geometry nodes don't generate damage on their own, but via their aggregation ancestor Draw nodes.
GeometryNode()15 GeometryNode::GeometryNode() : INHERITED(kBubbleDamage_Trait) {}
16 
clip(SkCanvas * canvas,bool aa) const17 void GeometryNode::clip(SkCanvas* canvas, bool aa) const {
18     SkASSERT(!this->hasInval());
19     this->onClip(canvas, aa);
20 }
21 
draw(SkCanvas * canvas,const SkPaint & paint) const22 void GeometryNode::draw(SkCanvas* canvas, const SkPaint& paint) const {
23     SkASSERT(!this->hasInval());
24     this->onDraw(canvas, paint);
25 }
26 
contains(const SkPoint & p) const27 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 
asPath() const32 SkPath GeometryNode::asPath() const {
33     SkASSERT(!this->hasInval());
34     return this->onAsPath();
35 }
36 
37 } // namespace sksg
38