Skip to main content
Version: 4.16

FrameBufferAllocator

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#

enumBlockState { EMPTY, ALLOCATED, DRAWN, SENDING }
BlockState is used for internal state of each block.

Public Functions#

virtual uint16_tallocateBlock(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 voidfreeBlockAfterTransfer() =0
Free a block after transfer to the LCD.
virtual const uint8_t *getBlockForTransfer(Rect & rect) =0
Get the block ready for transfer.
virtual boolhasBlockReadyForTransfer() =0
Check if a block is ready for transfer to the LCD.
virtual boolhasEmptyBlock() =0
Check if a block is ready for drawing (the block is empty).
virtual voidmarkBlockReadyForTransfer() =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#

BlockState is used for internal state of each block.

EMPTYBlock is empty, can be allocated.
ALLOCATEDBlock is allocated for drawing.
DRAWNBlock has been drawn to, can be send.
SENDINGBlock is being transmitted to the display.

Public Functions Documentation#

allocateBlock#

virtual uint16_t allocateBlock(const uint16_tx ,=0
const uint16_ty ,=0
const uint16_twidth ,=0
const uint16_theight ,=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.

Parameters:
xThe absolute x coordinate of the block on the screen.
yThe absolute y coordinate of the block on the screen.
widthThe width of the block.
heightThe height of the block.
blockPointer to pointer to return the block address in.
Returns:

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.

Parameters:
rectReference to rect to write block x, y, width, and height.
Returns:

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.

Returns:

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).

Returns:

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.

Returns:

Rect ready for transfer.

Note

This function should only be called when the allocator has a block ready for transfer.

See also:

Reimplemented by: touchgfx::ManyBlockAllocator::peekBlockForTransfer

~FrameBufferAllocator#

Finalizes an instance of the FrameBufferAllocator class.