Add avatar image loading from global ...

... settings directory.

Also adds some additional related debug logging, and a utility function
for converting between std::vector<image_pixel_t> used by Local_Storage::load_image(),
and std::string used by Settings::add_image().
This commit is contained in:
redpolline 2024-11-25 00:50:40 -05:00
parent 0eaba52f76
commit d493e30b98
4 changed files with 58 additions and 1 deletions

View file

@ -116,7 +116,10 @@ bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize )
if (image == settings->images.end()) return false;
unsigned size = image->second.data.size();
if (nDestBufferSize < size) size = nDestBufferSize;
if (nDestBufferSize < size) {
size = nDestBufferSize;
PRINT_DEBUG("GetImageRGBA %i Given buffer too small. Got 0x%x bytes. Need 0x%x bytes.", iImage, nDestBufferSize, size);
}
image->second.data.copy((char *)pubDest, nDestBufferSize);
return true;
}