Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
graphite
RuntimeEffectDictionary.h
Go to the documentation of this file.
1
/*
2
* Copyright 2022 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 skgpu_graphite_RuntimeEffectDictionary_DEFINED
9
#define skgpu_graphite_RuntimeEffectDictionary_DEFINED
10
11
#include "
include/core/SkRefCnt.h
"
12
#include "
include/effects/SkRuntimeEffect.h
"
13
#include "
src/core/SkTHash.h
"
14
15
class
SkRuntimeEffect
;
16
17
namespace
skgpu::graphite
{
18
19
// We keep track of all SkRuntimeEffects that are used by a recording, along with their code
20
// snippet ID. This ensures that we have a live reference to every effect that we're going to
21
// paint, and gives us a way to retrieve their shader text when we see their code-snippet ID.
22
class
RuntimeEffectDictionary
{
23
public
:
24
const
SkRuntimeEffect
*
find
(
int
codeSnippetID)
const
{
25
sk_sp<const SkRuntimeEffect>
* effect = fDict.
find
(codeSnippetID);
26
return
effect ? effect->
get
() :
nullptr
;
27
}
28
29
void
set(
int
codeSnippetID,
sk_sp<const SkRuntimeEffect>
effect);
30
31
void
reset
() { fDict.
reset
(); }
32
33
private
:
34
skia_private::THashMap<int, sk_sp<const SkRuntimeEffect>
> fDict;
35
};
36
37
}
// namespace skgpu::graphite
38
39
#endif
// skgpu_graphite_RuntimeEffectDictionary_DEFINED
SkRefCnt.h
SkRuntimeEffect.h
SkTHash.h
SkRuntimeEffect
Definition
SkRuntimeEffect.h:59
sk_sp
Definition
SkRefCnt.h:220
sk_sp::get
T * get() const
Definition
SkRefCnt.h:303
skgpu::graphite::RuntimeEffectDictionary
Definition
RuntimeEffectDictionary.h:22
skgpu::graphite::RuntimeEffectDictionary::reset
void reset()
Definition
RuntimeEffectDictionary.h:31
skgpu::graphite::RuntimeEffectDictionary::find
const SkRuntimeEffect * find(int codeSnippetID) const
Definition
RuntimeEffectDictionary.h:24
skia_private::THashMap
Definition
SkTHash.h:431
skia_private::THashMap::find
V * find(const K &key) const
Definition
SkTHash.h:479
skia_private::THashMap::reset
void reset()
Definition
SkTHash.h:457
skgpu::graphite
Definition
BoundsManagerBench.cpp:27
Generated on Fri Apr 26 2024 06:17:19 for Flutter Engine by
1.9.8