| 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. |
| 18 |
GeometryNode::GeometryNode() : INHERITED(kBubbleDamage_Trait) {} |
| 19 |
|
| 20 |
void GeometryNode::clip(SkCanvas* canvas, bool aa) const { |
| 21 |
SkASSERT(!this->hasInval()); |
| 22 |
this->onClip(canvas, aa); |
| 23 |
} |
| 24 |
|
| 25 |
void GeometryNode::draw(SkCanvas* canvas, const SkPaint& paint) const { |
| 26 |
SkASSERT(!this->hasInval()); |
| 27 |
this->onDraw(canvas, paint); |
| 28 |
} |
| 29 |
|
| 30 |
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 |
|
| 35 |
SkPath GeometryNode::asPath() const { |
| 36 |
SkASSERT(!this->hasInval()); |
| 37 |
return this->onAsPath(); |
| 38 |
} |
| 39 |
|
| 40 |
} // namespace sksg |