Coverage Report

Created: 2021-08-22 09:07

/src/skia/include/sksl/DSLModifiers.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2020 Google LLC
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 SKSL_DSL_MODIFIERS
9
#define SKSL_DSL_MODIFIERS
10
11
#include "include/core/SkSpan.h"
12
#include "include/private/SkSLModifiers.h"
13
#include "include/sksl/DSLLayout.h"
14
15
namespace SkSL {
16
17
namespace dsl {
18
19
class DSLField;
20
class DSLType;
21
22
enum Modifier {
23
    kNo_Modifier            =       0,
24
    kConst_Modifier         = 1 <<  0,
25
    kIn_Modifier            = 1 <<  1,
26
    kOut_Modifier           = 1 <<  2,
27
    kInOut_Modifier         = kIn_Modifier | kOut_Modifier,
28
    kUniform_Modifier       = 1 <<  3,
29
    kFlat_Modifier          = 1 <<  4,
30
    kNoPerspective_Modifier = 1 <<  5,
31
};
32
33
class DSLModifiers {
34
public:
35
    DSLModifiers(int flags = 0)
36
3.86k
        : DSLModifiers(DSLLayout(), flags) {}
37
38
    DSLModifiers(DSLLayout layout, int flags = 0)
39
3.86k
        : fModifiers(layout.fSkSLLayout, flags) {}
40
41
0
    int flags() const {
42
0
        return fModifiers.fFlags;
43
0
    }
44
45
0
    DSLLayout layout() const {
46
0
        return DSLLayout(fModifiers.fLayout);
47
0
    }
48
49
private:
50
    SkSL::Modifiers fModifiers;
51
52
    friend DSLType Struct(skstd::string_view name, SkSpan<DSLField> fields);
53
    friend class DSLCore;
54
    friend class DSLFunction;
55
    friend class DSLType;
56
    friend class DSLVarBase;
57
    friend class DSLWriter;
58
};
59
60
} // namespace dsl
61
62
} // namespace SkSL
63
64
#endif