跳转到主要内容

ManyBlockAllocator

touchgfx/hal/FrameBufferAllocator.hpp

This class is partial framebuffer allocator using multiple blocks. New buffers can be allocated until no free blocks are available. After transfer to LCD, a block is queued for allocation again.

See: FrameBufferAllocator

Inherits from: FrameBufferAllocator

Public Functions

virtual uint16_tallocateBlock(const uint16_t x, const uint16_t y, const uint16_t width, const uint16_t height, uint8_t ** block)
Allocates a framebuffer block.
virtual voidfreeBlockAfterTransfer()
Free a block after transfer to the LCD.
virtual const uint8_t *getBlockForTransfer(Rect & rect)
Get the block ready for transfer.
virtual boolhasBlockReadyForTransfer()
Check if a block is ready for transfer to the LCD.
virtual boolhasEmptyBlock()
Check if a block is ready for drawing (the block is empty).
ManyBlockAllocator()
virtual voidmarkBlockReadyForTransfer()
Marks a previously allocated block as ready to be transferred to the LCD.
virtual const Rect &peekBlockForTransfer()
Get the Rect of the next block to transfer.

Additional inherited members

Protected Types inherited from FrameBufferAllocator

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

Public Functions inherited from FrameBufferAllocator

virtual ~FrameBufferAllocator()
Finalizes an instance of the FrameBufferAllocator class.

Public Functions Documentation

allocateBlock

virtual uint16_t allocateBlock(const uint16_tx ,
const uint16_ty ,
const uint16_twidth ,
const uint16_theight ,
uint8_t **block
)

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.

Reimplements: touchgfx::FrameBufferAllocator::allocateBlock

freeBlockAfterTransfer

virtual void freeBlockAfterTransfer()

Free a block after transfer to the LCD.

Marks a previously allocated block as transferred and ready to reuse.

Reimplements: touchgfx::FrameBufferAllocator::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.

Reimplements: touchgfx::FrameBufferAllocator::getBlockForTransfer

hasBlockReadyForTransfer

virtual bool hasBlockReadyForTransfer()

Check if a block is ready for transfer to the LCD.

Returns:

True if a block is ready for transfer.

Reimplements: touchgfx::FrameBufferAllocator::hasBlockReadyForTransfer

hasEmptyBlock

virtual bool hasEmptyBlock()

Check if a block is ready for drawing (the block is empty).

Returns:

True if a block is empty.

Reimplements: touchgfx::FrameBufferAllocator::hasEmptyBlock

ManyBlockAllocator

markBlockReadyForTransfer

virtual void markBlockReadyForTransfer()

Marks a previously allocated block as ready to be transferred to the LCD.

Reimplements: touchgfx::FrameBufferAllocator::markBlockReadyForTransfer

peekBlockForTransfer

virtual const Rect & peekBlockForTransfer()

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:

Reimplements: touchgfx::FrameBufferAllocator::peekBlockForTransfer