xref: /aosp_15_r20/external/skia/modules/sksg/src/SkSGPlane.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #include "include/core/SkPathTypes.h"
13 #include "include/core/SkScalar.h"
14 #include "include/private/base/SkAssert.h"
15 
16 class SkMatrix;
17 struct SkPoint;
18 
19 namespace sksg {
20 Plane::Plane() = default;
21 
onClip(SkCanvas *,bool) const22 void Plane::onClip(SkCanvas*, bool) const {}
23 
onDraw(SkCanvas * canvas,const SkPaint & paint) const24 void Plane::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
25     canvas->drawPaint(paint);
26 }
27 
onContains(const SkPoint &) const28 bool Plane::onContains(const SkPoint&) const { return true; }
29 
onRevalidate(InvalidationController *,const SkMatrix &)30 SkRect Plane::onRevalidate(InvalidationController*, const SkMatrix&) {
31     SkASSERT(this->hasInval());
32 
33     return SkRect::MakeLTRB(SK_ScalarMin, SK_ScalarMin, SK_ScalarMax, SK_ScalarMax);
34 }
35 
onAsPath() const36 SkPath Plane::onAsPath() const {
37     SkPath path;
38     path.setFillType(SkPathFillType::kInverseWinding);
39 
40     return path;
41 }
42 
43 }  // namespace sksg
44