1 /*
2  * Copyright 2018 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/SkSGPlane.h"
9 
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkPath.h"
12 
13 namespace sksg {
14 
15 Plane::Plane() = default;
16 
onClip(SkCanvas *,bool) const17 void Plane::onClip(SkCanvas*, bool) const {}
18 
onDraw(SkCanvas * canvas,const SkPaint & paint) const19 void Plane::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
20     canvas->drawPaint(paint);
21 }
22 
onContains(const SkPoint &) const23 bool Plane::onContains(const SkPoint&) const { return true; }
24 
onRevalidate(InvalidationController *,const SkMatrix &)25 SkRect Plane::onRevalidate(InvalidationController*, const SkMatrix&) {
26     SkASSERT(this->hasInval());
27 
28     return SkRect::MakeLTRB(SK_ScalarMin, SK_ScalarMin, SK_ScalarMax, SK_ScalarMax);
29 }
30 
onAsPath() const31 SkPath Plane::onAsPath() const {
32     SkPath path;
33     path.setFillType(SkPathFillType::kInverseWinding);
34 
35     return path;
36 }
37 
38 } // namespace sksg
39