| Flutter Impeller |

Public Member Functions | Static Public Member Functions | List of all members
impeller::Allocation Class Reference

`#include <allocation.h>`

## 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 16 of file allocation.cc.

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

## Member Function Documentation

## ◆ GetBuffer()

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

Definition at line 20 of file allocation.cc.

20 {
21 return buffer_;
22 }

Referenced by impeller::ProcTableGLES::GetProgramInfoLogString().

## ◆ GetLength()

size_t impeller::Allocation::GetLength | ( |  | ) | const

Definition at line 24 of file allocation.cc.

24 {
25 return length_;
26 }

## ◆ GetReservedLength()

size_t impeller::Allocation::GetReservedLength | ( |  | ) | const

Definition at line 28 of file allocation.cc.

28 {
29 return reserved_;
30 }

## ◆ NextPowerOfTwoSize()

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

Definition at line 41 of file allocation.cc.

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

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

## ◆ Truncate()

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

Definition at line 32 of file allocation.cc.

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

Referenced by impeller::ProcTableGLES::GetProgramInfoLogString().

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

- impeller/base/allocation.h
- impeller/base/allocation.cc