mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use std::byte for glyph sprite buffer.
parent
c718858999
commit
5585363407
|
@ -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()); }
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue