Coverage Report

Created: 2021-08-22 09:07

/src/skia/modules/sksg/include/SkSGPath.h
Line
Count
Source (jump to first uncovered line)
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
#ifndef SkSGPath_DEFINED
9
#define SkSGPath_DEFINED
10
11
#include "modules/sksg/include/SkSGGeometryNode.h"
12
13
#include "include/core/SkPath.h"
14
15
class SkCanvas;
16
class SkPaint;
17
18
namespace sksg {
19
20
/**
21
 * Concrete Geometry node, wrapping an SkPath.
22
 */
23
class Path : public GeometryNode {
24
public:
25
80.6k
    static sk_sp<Path> Make()                { return sk_sp<Path>(new Path(SkPath())); }
26
0
    static sk_sp<Path> Make(const SkPath& r) { return sk_sp<Path>(new Path(r)); }
27
28
    SG_ATTRIBUTE(Path, SkPath, fPath)
29
30
    // Temporarily inlined for SkPathFillType staging
31
    // SG_MAPPED_ATTRIBUTE(FillType, SkPathFillType, fPath)
32
33
79.9k
    SkPathFillType getFillType() const {
34
79.9k
        return fPath.getFillType();
35
79.9k
    }
36
37
8.61k
    void setFillType(SkPathFillType fillType) {
38
8.61k
        if (fillType != fPath.getFillType()) {
39
1.79k
            fPath.setFillType(fillType);
40
1.79k
            this->invalidate();
41
1.79k
        }
42
8.61k
    }
43
44
protected:
45
    void onClip(SkCanvas*, bool antiAlias) const override;
46
    void onDraw(SkCanvas*, const SkPaint&) const override;
47
    bool onContains(const SkPoint&)        const override;
48
49
    SkRect onRevalidate(InvalidationController*, const SkMatrix&) override;
50
    SkPath onAsPath() const override;
51
52
private:
53
    explicit Path(const SkPath&);
54
55
    SkPath fPath;
56
57
    using INHERITED = GeometryNode;
58
};
59
60
} // namespace sksg
61
62
#endif // SkSGPath_DEFINED