FastUIDraw
|
An ImageAtlas is a common location to place images of an application. More...
#include <image_atlas.hpp>
Public Member Functions | |
const reference_counted_ptr< const AtlasColorBackingStoreBase > & | color_store (void) const |
int | color_tile_size (void) const |
reference_counted_ptr< Image > | create (int w, int h, const ImageSourceBase &image_data, enum Image::type_t type=Image::bindless_texture2d) |
reference_counted_ptr< Image > | create_non_atlas (int w, int h, const ImageSourceBase &image_data) |
void | flush (void) const |
const reference_counted_ptr< const AtlasIndexBackingStoreBase > & | index_store (void) const |
int | index_tile_size (void) const |
void | lock_resources (void) |
void | queue_resource_release_action (const reference_counted_ptr< Image::ResourceReleaseAction > &action) |
void | unlock_resources (void) |
Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter > | |
reference_counted_base (void) | |
Protected Member Functions | |
ImageAtlas (int pcolor_tile_size, int pindex_tile_size, reference_counted_ptr< AtlasColorBackingStoreBase > pcolor_store, reference_counted_ptr< AtlasIndexBackingStoreBase > pindex_store) | |
Friends | |
class | Image |
Additional Inherited Members | |
Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter > | |
static void | add_reference (const reference_counted_base< T, Counter > *p) |
static void | remove_reference (const reference_counted_base< T, Counter > *p) |
An ImageAtlas is a common location to place images of an application.
Ideally, all images are placed into a single ImageAtlas (changes of ImageAtlas force draw-call breaks). Methods of ImageAtlas are thread safe, locked behind a mutex of the ImageAtlas.
Definition at line 233 of file image_atlas.hpp.
|
protected |
Ctor.
pcolor_tile_size | size of each color tile, a value of 0 indicates that atlased Images are not allowed. |
pindex_tile_size | size of each index tile, a value of 0 indicates that atlased Images are not allowed. |
pcolor_store | color data backing store for atlas, the width and height of the backing store must be divisible by pcolor_tile_size. |
pindex_store | index backing store for atlas, the width and height of the backing store must be divisible by pindex_tile_size. |
const reference_counted_ptr<const AtlasColorBackingStoreBase>& fastuidraw::ImageAtlas::color_store | ( | void | ) | const |
Returns a handle to the backing store for the image data.
int fastuidraw::ImageAtlas::color_tile_size | ( | void | ) | const |
Returns the size (in texels) used for the color tiles.
reference_counted_ptr<Image> fastuidraw::ImageAtlas::create | ( | int | w, |
int | h, | ||
const ImageSourceBase & | image_data, | ||
enum Image::type_t | type = Image::bindless_texture2d |
||
) |
Construct an Image
w | width of the image |
h | height of the image |
image_data | image data to which to initialize the image |
type | the preferred value for Image::type() for the returned Image Image::bindless_texture2d will fallback to Image::on_atlas and Image::on_atlas will fallback to Image::context_texture2d |
reference_counted_ptr<Image> fastuidraw::ImageAtlas::create_non_atlas | ( | int | w, |
int | h, | ||
const ImageSourceBase & | image_data | ||
) |
Construct an Image whose Image::type() is NOT Image::on_atlas. Will first try to construct an Image whose Image::type() is Image::bindless_texture2d and if that failes will instead construct an Image whose Image::type() is Image::context_texture2d
w | width of the image |
h | height of the image |
image_data | image data to which to initialize the image |
void fastuidraw::ImageAtlas::flush | ( | void | ) | const |
Calls AtlasIndexBackingStoreBase::flush() on the index backing store (see index_store()) and AtlasColorBackingStoreBase::flush() on the color backing store (see color_store()).
const reference_counted_ptr<const AtlasIndexBackingStoreBase>& fastuidraw::ImageAtlas::index_store | ( | void | ) | const |
Returns a handle to the backing store for the index data.
int fastuidraw::ImageAtlas::index_tile_size | ( | void | ) | const |
Returns the size (in texels) used for the index tiles.
void fastuidraw::ImageAtlas::lock_resources | ( | void | ) |
Increments an internal counter. If this internal counter is greater than zero, then the reurning of tiles to the free store for later use is -delayed- until the counter reaches zero again (see unlock_resources()). The use case is for buffered painting where the GPU calls are delayed for later (to batch commands) and an Image may go out of scope before the GPU commands are sent to the GPU. By delaying the return of an Image's tiles to the freestore, the image data is valid still for rendering.
void fastuidraw::ImageAtlas::queue_resource_release_action | ( | const reference_counted_ptr< Image::ResourceReleaseAction > & | action | ) |
Queue a ResourceReleaseAction to be executed when resources are not locked down, see lock_resources() and unlock_resources().
void fastuidraw::ImageAtlas::unlock_resources | ( | void | ) |
Decrements an internal counter. If this internal counter reaches zero, those tiles from Image's that were deleted while the counter was non-zero, are then returned to the tile free store. See lock_resources() for more details.