FrameBufferAllocator
touchgfx/hal/FrameBufferAllocator.hpp
This class is an abstract interface for a class allocating partial framebuffer blocks. The interface must be implemented by a subclass.
See: ManyBlockAllocator
Inherited by: ManyBlockAllocator< block_size, blocks, bytes_pr_pixel >
Protected Types
enum | BlockState { EMPTY, ALLOCATED, DRAWN, SENDING } |
BlockState is used for internal state of each block. | |
Public Functions
virtual uint16_t | allocateBlock(const uint16_t x, const uint16_t y, const uint16_t width, const uint16_t height, uint8_t ** block) =0 |
Allocates a framebuffer block. | |
virtual void | freeBlockAfterTransfer() =0 |
Free a block after transfer to the LCD. | |
virtual const uint8_t * | getBlockForTransfer(Rect & rect) =0 |
Get the block ready for transfer. | |
virtual bool | hasBlockReadyForTransfer() =0 |
Check if a block is ready for transfer to the LCD. | |
virtual bool | hasEmptyBlock() =0 |
Check if a block is ready for drawing (the block is empty). | |
virtual void | markBlockReadyForTransfer() =0 |
Marks a previously allocated block as ready to be transferred to the LCD. | |
virtual const Rect & | peekBlockForTransfer() =0 |
Get the Rect of the next block to transfer. | |
virtual | ~FrameBufferAllocator() |
Finalizes an instance of the FrameBufferAllocator class. | |
Protected Types Documentation
BlockState
enum BlockState
BlockState is used for internal state of each block.
EMPTY | Block is empty, can be allocated. |
ALLOCATED | Block is allocated for drawing. |
DRAWN | Block has been drawn to, can be send. |
SENDING | Block is being transmitted to the display. |
Public Functions Documentation
allocateBlock
virtual uint16_t allocateBlock | ( | const uint16_t | x , | =0 | |
const uint16_t | y , | =0 | |||
const uint16_t | width , | =0 | |||
const uint16_t | height , | =0 | |||
uint8_t ** | block | =0 | |||
) | =0 |
Allocates a framebuffer block.
The block will have at least the width requested. The height of the allocated block can be lower than requested if not enough memory is available.
x | The absolute x coordinate of the block on the screen. |
y | The absolute y coordinate of the block on the screen. |
width | The width of the block. |
height | The height of the block. |
block | Pointer to pointer to return the block address in. |
The height of the allocated block.
Reimplemented by: touchgfx::ManyBlockAllocator::allocateBlock
freeBlockAfterTransfer
virtual void freeBlockAfterTransfer | ( | ) | =0 |
Free a block after transfer to the LCD.
Marks a previously allocated block as transferred and ready to reuse.
Reimplemented by: touchgfx::ManyBlockAllocator::freeBlockAfterTransfer
getBlockForTransfer
virtual const uint8_t * getBlockForTransfer | ( | Rect & | rect | ) | |
Get the block ready for transfer.
rect | Reference to rect to write block x, y, width, and height. |
Returns the address of the block ready for transfer.
Reimplemented by: touchgfx::ManyBlockAllocator::getBlockForTransfer
hasBlockReadyForTransfer
virtual bool hasBlockReadyForTransfer | ( | ) | =0 |
Check if a block is ready for transfer to the LCD.
True if a block is ready for transfer.
Reimplemented by: touchgfx::ManyBlockAllocator::hasBlockReadyForTransfer
hasEmptyBlock
virtual bool hasEmptyBlock | ( | ) | =0 |
Check if a block is ready for drawing (the block is empty).
True if a block is empty.
Reimplemented by: touchgfx::ManyBlockAllocator::hasEmptyBlock
markBlockReadyForTransfer
virtual void markBlockReadyForTransfer | ( | ) | =0 |
Marks a previously allocated block as ready to be transferred to the LCD.
Reimplemented by: touchgfx::ManyBlockAllocator::markBlockReadyForTransfer
peekBlockForTransfer
virtual const Rect & peekBlockForTransfer | ( | ) | =0 |
Get the Rect of the next block to transfer.
Rect ready for transfer.
Note
This function should only be called when the allocator has a block ready for transfer.
Reimplemented by: touchgfx::ManyBlockAllocator::peekBlockForTransfer
~FrameBufferAllocator
virtual ~FrameBufferAllocator | ( | ) |
Finalizes an instance of the FrameBufferAllocator class.