1
0
Fork 0

Codechange: Use std::byte for glyph sprite buffer.

pull/12096/head
Peter Nelson 2025-05-13 00:48:05 +01:00 committed by Peter Nelson
parent c718858999
commit 5585363407
3 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ protected:
/** Container for information about a glyph. */ /** Container for information about a glyph. */
struct GlyphEntry { struct GlyphEntry {
std::unique_ptr<uint8_t[]> data; ///< The loaded sprite. std::unique_ptr<std::byte[]> data; ///< The loaded sprite.
uint8_t width = 0; ///< The width of the glyph. uint8_t width = 0; ///< The width of the glyph.
Sprite *GetSprite() { return reinterpret_cast<Sprite *>(data.get()); } Sprite *GetSprite() { return reinterpret_cast<Sprite *>(data.get()); }

View File

@ -899,7 +899,7 @@ void *CacheSpriteAllocator::AllocatePtr(size_t mem_req)
void *UniquePtrSpriteAllocator::AllocatePtr(size_t size) void *UniquePtrSpriteAllocator::AllocatePtr(size_t size)
{ {
this->data = std::make_unique<uint8_t[]>(size); this->data = std::make_unique<std::byte[]>(size);
return this->data.get(); return this->data.get();
} }

View File

@ -34,7 +34,7 @@ extern uint _sprite_cache_size;
/** SpriteAllocator that allocates memory via a unique_ptr array. */ /** SpriteAllocator that allocates memory via a unique_ptr array. */
class UniquePtrSpriteAllocator : public SpriteAllocator { class UniquePtrSpriteAllocator : public SpriteAllocator {
public: public:
std::unique_ptr<uint8_t[]> data; std::unique_ptr<std::byte[]> data;
protected: protected:
void *AllocatePtr(size_t size) override; void *AllocatePtr(size_t size) override;
}; };