Coverage Report

Created: 2024-05-20 07:14

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