Debian Codegraph @

modules/sksg/src/SkSGPlane.cpp

raw
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
22 void Plane::onClip(SkCanvas*, bool) const {}
23
24 void Plane::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
25 canvas->drawPaint(paint);
26 }
27
28 bool Plane::onContains(const SkPoint&) const { return true; }
29
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
36 SkPath Plane::onAsPath() const {
37 SkPath path;
38 path.setFillType(SkPathFillType::kInverseWinding);
39
40 return path;
41 }
42
43 } // namespace sksg