Coverage Report

Created: 2024-05-20 07:14

/src/skia/modules/svg/include/SkSVGFeComponentTransfer.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2024 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 SkSVGFeComponentTransfer_DEFINED
9
#define SkSVGFeComponentTransfer_DEFINED
10
11
#include "modules/svg/include/SkSVGFe.h"
12
#include "modules/svg/include/SkSVGHiddenContainer.h"
13
#include "modules/svg/include/SkSVGNode.h"
14
#include "modules/svg/include/SkSVGTypes.h"
15
16
#include <cstdint>
17
18
class SkSVGFeFunc final : public SkSVGHiddenContainer {
19
public:
20
0
    static sk_sp<SkSVGFeFunc> MakeFuncA() {
21
0
        return sk_sp<SkSVGFeFunc>(new SkSVGFeFunc(SkSVGTag::kFeFuncA));
22
0
    }
23
24
0
    static sk_sp<SkSVGFeFunc> MakeFuncR() {
25
0
        return sk_sp<SkSVGFeFunc>(new SkSVGFeFunc(SkSVGTag::kFeFuncR));
26
0
    }
27
28
0
    static sk_sp<SkSVGFeFunc> MakeFuncG() {
29
0
        return sk_sp<SkSVGFeFunc>(new SkSVGFeFunc(SkSVGTag::kFeFuncG));
30
0
    }
31
32
0
    static sk_sp<SkSVGFeFunc> MakeFuncB() {
33
0
        return sk_sp<SkSVGFeFunc>(new SkSVGFeFunc(SkSVGTag::kFeFuncB));
34
0
    }
35
36
    SVG_ATTR(Amplitude  , SkSVGNumberType,                          1)
37
    SVG_ATTR(Exponent   , SkSVGNumberType,                          1)
38
    SVG_ATTR(Intercept  , SkSVGNumberType,                          0)
39
    SVG_ATTR(Offset     , SkSVGNumberType,                          0)
40
    SVG_ATTR(Slope      , SkSVGNumberType,                          1)
41
    SVG_ATTR(TableValues, std::vector<SkSVGNumberType>,            {})
42
    SVG_ATTR(Type       , SkSVGFeFuncType, SkSVGFeFuncType::kIdentity)
43
44
    std::vector<uint8_t> getTable() const;
45
46
protected:
47
    bool parseAndSetAttribute(const char*, const char*) override;
48
49
private:
50
0
    SkSVGFeFunc(SkSVGTag tag) : INHERITED(tag) {}
51
52
    using INHERITED = SkSVGHiddenContainer;
53
};
54
55
class SK_API SkSVGFeComponentTransfer final : public SkSVGFe {
56
public:
57
    static constexpr SkSVGTag tag = SkSVGTag::kFeComponentTransfer;
58
59
0
    static sk_sp<SkSVGFeComponentTransfer> Make() {
60
0
        return sk_sp<SkSVGFeComponentTransfer>(new SkSVGFeComponentTransfer());
61
0
    }
62
63
protected:
64
    sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&,
65
                                           const SkSVGFilterContext&) const override;
66
67
0
    std::vector<SkSVGFeInputType> getInputs() const override { return {this->getIn()}; }
68
69
private:
70
0
    SkSVGFeComponentTransfer() : INHERITED(tag) {}
71
72
    using INHERITED = SkSVGFe;
73
};
74
75
#endif //  SkSVGFeComponentTransfer_DEFINED