class GUIVectorSpriteAtlas

Manages a cache of all VectorPath objects used by the GUI and maintains an atlas containing their rasterized representation for use by GUI.

Public

Constructors

GUIVectorSpriteAtlas

GUIVectorSpriteAtlas(const GUIVectorSpriteAtlasSettings &settings)

Methods

~GUIVectorSpriteAtlas

~GUIVectorSpriteAtlas()

Allocate

GUIVectorSpriteAtlasAllocation Allocate(const VectorPath &vectorPath, const VectorGraphicsSettings &settings)

Allocates a new sprite entry in the atlas.

If the entry with the same path

& settings combination already exists, an existing entry will be returned instead. Note that before using the texture that is part of the allocation you must call RenderDirtySprites() on the render thread.

Update

void Update()

To be called once per frame on the main thread.

RenderDirtySprites

void RenderDirtySprites(u32 bufferIndex)

Render any sprites that are newly allocated.

Render thread only.

Private

Methods

NotifyAllocationReleased

void NotifyAllocationReleased(GUIVectorSpriteAtlasAllocationHandle *allocationHandle)

Triggered by the GUIVectorSpriteAtlasAllocation deleter.

CreateOrFindTexture

HTexture CreateOrFindTexture(Size2UI size) const

Attempts to find an existing unused texture matching the requested size, or creates a new texture.

ReleaseTexture

void ReleaseTexture(const HTexture &texture)

Notifies the system that a texture is no longer being used.

GetNextUniqueTextureId

u32 GetNextUniqueTextureId() const

Returns the next available texture ID.

ReleaseTextureId

void ReleaseTextureId(u32 id)

Notifies the system that the specified texture ID is no longer being used.

DestroyPendingReleasedAllocations

void DestroyPendingReleasedAllocations()

Cleans up any allocations that were released, but haven't yet been destroyed.

Fields

mSettings

mAtlasLayout

mAtlasLayoutTextures

UnorderedMap<u32, HTexture> mAtlasLayoutTextures

mUniqueTextures

UnorderedMap<u32, HTexture> mUniqueTextures

mAllocationsMutex

Mutex mAllocationsMutex

mFreeAllocations

Vector<FreeAllocationInformation> mFreeAllocations

mFreeAllocationsTemp

Vector<FreeAllocationInformation> mFreeAllocationsTemp

mDirtySpriteWriteBufferIndex

u32 mDirtySpriteWriteBufferIndex

mDirtySpriteBuffers

Vector<DirtySpriteInformation>[3] mDirtySpriteBuffers

mFreeTextureCache

UnorderedMap<FreeTextureInformation::Key, FreeTextureInformation, FreeTextureInformation::Key::Hash> mFreeTextureCache

mFreeUniqueTextureIds

Vector<u32> mFreeUniqueTextureIds

mNextUniqueTextureId

u32 mNextUniqueTextureId