Flutter Impeller
impeller::Allocation Class Reference

#include <allocation.h>

Inheritance diagram for impeller::Allocation:
impeller::HostBuffer

Public Member Functions

 Allocation ()
 
 ~Allocation ()
 
uint8_t * GetBuffer () const
 
size_t GetLength () const
 
size_t GetReservedLength () const
 
bool Truncate (size_t length, bool npot=true)
 

Static Public Member Functions

static uint32_t NextPowerOfTwoSize (uint32_t x)
 

Detailed Description

Definition at line 15 of file allocation.h.

Constructor & Destructor Documentation

◆ Allocation()

impeller::Allocation::Allocation ( )
default

◆ ~Allocation()

impeller::Allocation::~Allocation ( )

Definition at line 17 of file allocation.cc.

17  {
18  ::free(buffer_);
19 }

Member Function Documentation

◆ GetBuffer()

uint8_t * impeller::Allocation::GetBuffer ( ) const

◆ GetLength()

size_t impeller::Allocation::GetLength ( ) const

Definition at line 25 of file allocation.cc.

25  {
26  return length_;
27 }

Referenced by impeller::HostBuffer::Emplace(), and impeller::ArchiveStatement::WriteValue().

◆ GetReservedLength()

size_t impeller::Allocation::GetReservedLength ( ) const

Definition at line 29 of file allocation.cc.

29  {
30  return reserved_;
31 }

Referenced by impeller::HostBuffer::GetSize().

◆ NextPowerOfTwoSize()

uint32_t impeller::Allocation::NextPowerOfTwoSize ( uint32_t  x)
static

Definition at line 42 of file allocation.cc.

42  {
43  if (x == 0) {
44  return 1;
45  }
46 
47  --x;
48 
49  x |= x >> 1;
50  x |= x >> 2;
51  x |= x >> 4;
52  x |= x >> 8;
53  x |= x >> 16;
54 
55  return x + 1;
56 }

Referenced by impeller::scene::Skin::GetJointsTexture(), and impeller::OptimumAtlasSizeForFontGlyphPairs().

◆ Truncate()

bool impeller::Allocation::Truncate ( size_t  length,
bool  npot = true 
)

Definition at line 33 of file allocation.cc.

33  {
34  const auto reserved = npot ? ReserveNPOT(length) : Reserve(length);
35  if (!reserved) {
36  return false;
37  }
38  length_ = length;
39  return true;
40 }

Referenced by impeller::HostBuffer::Emplace(), impeller::ProcTableGLES::GetProgramInfoLogString(), impeller::ArchiveStatement::ReadValue(), and impeller::HostBuffer::Reset().


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