Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skgpu::KeyBuilder Class Reference

#include <KeyBuilder.h>

Inheritance diagram for skgpu::KeyBuilder:
skgpu::StringKeyBuilder

Public Member Functions

 KeyBuilder (skia_private::TArray< uint32_t, true > *data)
 
virtual ~KeyBuilder ()
 
virtual void addBits (uint32_t numBits, uint32_t val, std::string_view label)
 
void addBytes (uint32_t numBytes, const void *data, std::string_view label)
 
void addBool (bool b, std::string_view label)
 
void add32 (uint32_t v, std::string_view label="unknown")
 
virtual void appendComment (const char *comment)
 
void flush ()
 

Detailed Description

Definition at line 20 of file KeyBuilder.h.

Constructor & Destructor Documentation

◆ KeyBuilder()

skgpu::KeyBuilder::KeyBuilder ( skia_private::TArray< uint32_t, true > *  data)
inline

Definition at line 22 of file KeyBuilder.h.

22: fData(data) {}

◆ ~KeyBuilder()

virtual skgpu::KeyBuilder::~KeyBuilder ( )
inlinevirtual

Definition at line 24 of file KeyBuilder.h.

24 {
25 // Ensure that flush was called before we went out of scope
26 SkASSERT(fBitsUsed == 0);
27 }
#define SkASSERT(cond)
Definition SkAssert.h:116

Member Function Documentation

◆ add32()

void skgpu::KeyBuilder::add32 ( uint32_t  v,
std::string_view  label = "unknown" 
)
inline

Definition at line 58 of file KeyBuilder.h.

58 {
59 this->addBits(32, v, label);
60 }
virtual void addBits(uint32_t numBits, uint32_t val, std::string_view label)
Definition KeyBuilder.h:29

◆ addBits()

virtual void skgpu::KeyBuilder::addBits ( uint32_t  numBits,
uint32_t  val,
std::string_view  label 
)
inlinevirtual

Reimplemented in skgpu::StringKeyBuilder.

Definition at line 29 of file KeyBuilder.h.

29 {
30 SkASSERT(numBits > 0 && numBits <= 32);
31 SkASSERT(numBits == 32 || (val < (1u << numBits)));
32
33 fCurValue |= (val << fBitsUsed);
34 fBitsUsed += numBits;
35
36 if (fBitsUsed >= 32) {
37 // Overflow, start a new working value
38 fData->push_back(fCurValue);
39 uint32_t excess = fBitsUsed - 32;
40 fCurValue = excess ? (val >> (numBits - excess)) : 0;
41 fBitsUsed = excess;
42 }
43
44 SkASSERT(fCurValue < (1u << fBitsUsed));
45 }

◆ addBool()

void skgpu::KeyBuilder::addBool ( bool  b,
std::string_view  label 
)
inline

Definition at line 54 of file KeyBuilder.h.

54 {
55 this->addBits(1, b, label);
56 }
static bool b

◆ addBytes()

void skgpu::KeyBuilder::addBytes ( uint32_t  numBytes,
const void *  data,
std::string_view  label 
)
inline

Definition at line 47 of file KeyBuilder.h.

47 {
48 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
49 for (; numBytes --> 0; bytes++) {
50 this->addBits(8, *bytes, label);
51 }
52 }
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

◆ appendComment()

virtual void skgpu::KeyBuilder::appendComment ( const char *  comment)
inlinevirtual

Reimplemented in skgpu::StringKeyBuilder.

Definition at line 62 of file KeyBuilder.h.

62{}

◆ flush()

void skgpu::KeyBuilder::flush ( )
inline

Definition at line 66 of file KeyBuilder.h.

66 {
67 if (fBitsUsed) {
68 fData->push_back(fCurValue);
69 fCurValue = 0;
70 fBitsUsed = 0;
71 }
72 }

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