Urho3D
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Urho3D::AreaAllocator Class Reference

Rectangular area allocator. More...

#include </home/runner/work/urho3d-doxygen.github.io/urho3d-doxygen.github.io/urho3d_repo/Source/Urho3D/Math/AreaAllocator.h>

Public Member Functions

 AreaAllocator ()
 Default construct with empty size.
 
 AreaAllocator (i32 width, i32 height, bool fastMode=true)
 Construct with given width and height.
 
 AreaAllocator (i32 width, i32 height, i32 maxWidth, i32 maxHeight, bool fastMode=true)
 Construct with given width and height, and set the maximum it allows to grow.
 
void Reset (i32 width, i32 height, i32 maxWidth=0, i32 maxHeight=0, bool fastMode=true)
 Reset to given width and height and remove all previous allocations.
 
bool Allocate (i32 width, i32 height, i32 &x, i32 &y)
 Try to allocate an area. Return true if successful, with x & y coordinates filled.
 
i32 GetWidth () const
 Return the current width.
 
i32 GetHeight () const
 Return the current height.
 
bool GetFastMode () const
 Return whether uses fast mode. Fast mode uses a simpler allocation scheme which may waste free space, but is OK for eg. fonts.
 

Private Member Functions

bool SplitRect (i32 freeAreaIndex, const IntRect &reserve)
 Remove space from a free rectangle. Return true if the original rectangle should be erased from the free list. Not called in fast mode.
 
void Cleanup ()
 Clean up redundant free space. Not called in fast mode.
 

Private Attributes

Vector< IntRectfreeAreas_
 Free rectangles.
 
IntVector2 size_
 Current size.
 
IntVector2 maxSize_
 Maximum size it allows to grow. It is zero when it is not allowed to grow.
 
bool doubleWidth_ {true}
 The dimension use for next growth. Used internally.
 
bool fastMode_ {true}
 Fast mode flag.
 

Detailed Description

Rectangular area allocator.


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