Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
skgpu::ResourceKey::Builder Class Reference

#include <ResourceKey.h>

Inheritance diagram for skgpu::ResourceKey::Builder:
skgpu::ScratchKey::Builder skgpu::UniqueKey::Builder skgpu::graphite::GraphiteResourceKey::Builder

Public Member Functions

 ~Builder ()
 
void finish ()
 
uint32_t & operator[] (int dataIdx)
 

Protected Member Functions

 Builder (ResourceKey *key, uint32_t domain, int data32Count)
 

Detailed Description

Used to initialize a key.

Definition at line 58 of file ResourceKey.h.

Constructor & Destructor Documentation

◆ ~Builder()

skgpu::ResourceKey::Builder::~Builder ( )
inline

Definition at line 60 of file ResourceKey.h.

60{ this->finish(); }

◆ Builder()

skgpu::ResourceKey::Builder::Builder ( ResourceKey key,
uint32_t  domain,
int  data32Count 
)
inlineprotected

Definition at line 80 of file ResourceKey.h.

80 : fKey(key) {
81 size_t count = SkToSizeT(data32Count);
83 key->fKey.reset(kMetaDataCnt + count);
84 size_t size = (count + kMetaDataCnt) * sizeof(uint32_t);
87 key->fKey[kDomainAndSize_MetaDataIdx] = SkToU32(domain | (size << 16));
88 }
int count
Definition: FontMgrTest.cpp:50
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr size_t SkToSizeT(S x)
Definition: SkTo.h:31
constexpr uint16_t SkToU16(S x)
Definition: SkTo.h:24
constexpr uint32_t SkToU32(S x)
Definition: SkTo.h:26
size_t size() const
Definition: ResourceKey.h:42
static const uint32_t kInvalidDomain
Definition: ResourceKey.h:95
uint32_t domain() const
Definition: ResourceKey.h:121

Member Function Documentation

◆ finish()

void skgpu::ResourceKey::Builder::finish ( )
inline

Definition at line 62 of file ResourceKey.h.

62 {
63 if (nullptr == fKey) {
64 return;
65 }
66 uint32_t* hash = &fKey->fKey[kHash_MetaDataIdx];
67 *hash = ResourceKeyHash(hash + 1, fKey->internalSize() - sizeof(uint32_t));
68 fKey->validate();
69 fKey = nullptr;
70 }
uint32_t hash() const
Definition: ResourceKey.h:37
uint32_t ResourceKeyHash(const uint32_t *data, size_t size)
Definition: ResourceKey.cpp:38

◆ operator[]()

uint32_t & skgpu::ResourceKey::Builder::operator[] ( int  dataIdx)
inline

Definition at line 72 of file ResourceKey.h.

72 {
73 SkASSERT(fKey);
74 SkDEBUGCODE(size_t dataCount = fKey->internalSize() / sizeof(uint32_t) - kMetaDataCnt;)
75 SkASSERT(SkToU32(dataIdx) < dataCount);
76 return fKey->fKey[(int)kMetaDataCnt + dataIdx];
77 }
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()

The documentation for this class was generated from the following file: