Flutter Engine
The Flutter Engine
third_party
skia
src
sksl
SkSLIntrinsicList.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2021 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
#include "
src/base/SkNoDestructor.h
"
9
#include "
src/base/SkStringView.h
"
10
#include "
src/sksl/SkSLIntrinsicList.h
"
11
12
using namespace
skia_private
;
13
14
namespace
SkSL
{
15
16
const
IntrinsicMap
&
GetIntrinsicMap
() {
17
#define SKSL_INTRINSIC(name) {#name, k_##name##_IntrinsicKind},
18
static
const
SkNoDestructor<IntrinsicMap>
kAllIntrinsics(
IntrinsicMap
{
19
SKSL_INTRINSIC_LIST
20
});
21
#undef SKSL_INTRINSIC
22
23
return
*kAllIntrinsics;
24
}
25
26
IntrinsicKind
FindIntrinsicKind
(std::string_view functionName) {
27
if
(
skstd::starts_with
(functionName,
'$'
)) {
28
functionName.remove_prefix(1);
29
}
30
31
const
IntrinsicMap
& intrinsicMap =
GetIntrinsicMap
();
32
IntrinsicKind
* kind = intrinsicMap.
find
(functionName);
33
return
kind ? *kind :
kNotIntrinsic
;
34
}
35
36
}
// namespace SkSL
SkNoDestructor.h
SkSLIntrinsicList.h
SkStringView.h
SkNoDestructor
Definition:
SkNoDestructor.h:84
skia_private::THashMap
Definition:
SkTHash.h:442
skia_private::THashMap::find
V * find(const K &key) const
Definition:
SkTHash.h:494
SkSL
Definition:
SkCapabilities.h:15
SkSL::GetIntrinsicMap
const IntrinsicMap & GetIntrinsicMap()
Definition:
SkSLIntrinsicList.cpp:16
SkSL::IntrinsicKind
IntrinsicKind
Definition:
SkSLIntrinsicList.h:128
SkSL::kNotIntrinsic
@ kNotIntrinsic
Definition:
SkSLIntrinsicList.h:129
SkSL::SKSL_INTRINSIC_LIST
@ SKSL_INTRINSIC_LIST
Definition:
SkSLIntrinsicList.h:130
SkSL::FindIntrinsicKind
IntrinsicKind FindIntrinsicKind(std::string_view functionName)
Definition:
SkSLIntrinsicList.cpp:26
skia_private
Definition:
SkTArray.h:32
skstd::starts_with
constexpr bool starts_with(std::string_view str, std::string_view prefix)
Definition:
SkStringView.h:17
Generated on Sun Jun 23 2024 21:56:35 for Flutter Engine by
1.9.4