Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSGGeometryNode.cpp
Go to the documentation of this file.
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
9
10#include "include/core/SkPath.h"
12#include "include/core/SkRect.h"
14
15namespace sksg {
16
17// Geometry nodes don't generate damage on their own, but via their aggregation ancestor Draw nodes.
18GeometryNode::GeometryNode() : INHERITED(kBubbleDamage_Trait) {}
19
20void GeometryNode::clip(SkCanvas* canvas, bool aa) const {
21 SkASSERT(!this->hasInval());
22 this->onClip(canvas, aa);
23}
24
25void GeometryNode::draw(SkCanvas* canvas, const SkPaint& paint) const {
26 SkASSERT(!this->hasInval());
27 this->onDraw(canvas, paint);
28}
29
30bool 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
36 SkASSERT(!this->hasInval());
37 return this->onAsPath();
38}
39
40} // namespace sksg
#define SkASSERT(cond)
Definition SkAssert.h:116
bool contains(const SkPoint &) const
virtual void onClip(SkCanvas *, bool antiAlias) const =0
virtual SkPath onAsPath() const =0
virtual bool onContains(const SkPoint &) const =0
void clip(SkCanvas *, bool antiAlias) const
virtual void onDraw(SkCanvas *, const SkPaint &) const =0
void draw(SkCanvas *, const SkPaint &) const
const SkRect & bounds() const
Definition SkSGNode.h:55
bool hasInval() const
Definition SkSGNode.h:60
const Paint & paint
Definition Skottie.h:32
constexpr float x() const
bool contains(SkScalar x, SkScalar y) const
Definition extension.cpp:19