mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Pass SpriteType as direct parameter to SpriteEncoder::Encoder.
parent
c3aa3f140c
commit
bb767608de
|
@ -39,8 +39,10 @@ public:
|
|||
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent, bool animated>
|
||||
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override {
|
||||
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
|
||||
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override
|
||||
{
|
||||
return Blitter_32bppSSE_Base::Encode(sprite_type, sprite, allocator);
|
||||
}
|
||||
std::string_view GetName() override { return "32bpp-sse4-anim"; }
|
||||
using Blitter_32bppSSE2_Anim::LookupColourInPalette;
|
||||
|
|
|
@ -285,7 +285,8 @@ void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode,
|
|||
this->Draw<false>(bp, mode, zoom);
|
||||
}
|
||||
|
||||
template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
template <bool Tpal_to_rgb>
|
||||
Sprite *Blitter_32bppOptimized::EncodeInternal(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
/* streams of pixels (a, r, g, b channels)
|
||||
*
|
||||
|
@ -306,7 +307,7 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
|
|||
ZoomLevel zoom_min;
|
||||
ZoomLevel zoom_max;
|
||||
|
||||
if (sprite[ZOOM_LVL_MIN].type == SpriteType::Font) {
|
||||
if (sprite_type == SpriteType::Font) {
|
||||
zoom_min = ZOOM_LVL_MIN;
|
||||
zoom_max = ZOOM_LVL_MIN;
|
||||
} else {
|
||||
|
@ -435,10 +436,10 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
|
|||
return dest_sprite;
|
||||
}
|
||||
|
||||
template Sprite *Blitter_32bppOptimized::EncodeInternal<true>(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
template Sprite *Blitter_32bppOptimized::EncodeInternal<false>(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
template Sprite *Blitter_32bppOptimized::EncodeInternal<true>(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
template Sprite *Blitter_32bppOptimized::EncodeInternal<false>(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
|
||||
Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
Sprite *Blitter_32bppOptimized::Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
return this->EncodeInternal<true>(sprite, allocator);
|
||||
return this->EncodeInternal<true>(sprite_type, sprite, allocator);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
};
|
||||
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
|
||||
std::string_view GetName() override { return "32bpp-optimized"; }
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
protected:
|
||||
template <bool Tpal_to_rgb> void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
template <bool Tpal_to_rgb> Sprite *EncodeInternal(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
template <bool Tpal_to_rgb> Sprite *EncodeInternal(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
};
|
||||
|
||||
/** Factory for the optimised 32 bpp blitter (without palette animation). */
|
||||
|
|
|
@ -115,7 +115,7 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
|
|||
Debug(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('{}')", pal);
|
||||
}
|
||||
|
||||
Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
Sprite *Blitter_32bppSimple::Encode(SpriteType, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
Blitter_32bppSimple::Pixel *dst;
|
||||
Sprite *dest_sprite = allocator.Allocate<Sprite>(sizeof(*dest_sprite) + static_cast<size_t>(sprite[ZOOM_LVL_MIN].height) * static_cast<size_t>(sprite[ZOOM_LVL_MIN].width) * sizeof(*dst));
|
||||
|
|
|
@ -26,7 +26,7 @@ class Blitter_32bppSimple : public Blitter_32bppBase {
|
|||
public:
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
|
||||
std::string_view GetName() override { return "32bpp-simple"; }
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/** Instantiation of the SSE2 32bpp blitter factory. */
|
||||
static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;
|
||||
|
||||
Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
Sprite *Blitter_32bppSSE_Base::Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
/* First uint32_t of a line = the number of transparent pixels from the left.
|
||||
* Second uint32_t of a line = the number of transparent pixels from the right.
|
||||
|
@ -28,7 +28,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &spri
|
|||
*/
|
||||
ZoomLevel zoom_min = ZOOM_LVL_MIN;
|
||||
ZoomLevel zoom_max = ZOOM_LVL_MIN;
|
||||
if (sprite[ZOOM_LVL_MIN].type != SpriteType::Font) {
|
||||
if (sprite_type != SpriteType::Font) {
|
||||
zoom_min = _settings_client.gui.zoom_min;
|
||||
zoom_max = _settings_client.gui.zoom_max;
|
||||
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX;
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
uint8_t data[]; ///< Data, all zoomlevels.
|
||||
};
|
||||
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator);
|
||||
};
|
||||
|
||||
/** The SSE2 32 bpp blitter (without palette animation). */
|
||||
|
@ -87,8 +87,9 @@ public:
|
|||
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
|
||||
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override {
|
||||
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override
|
||||
{
|
||||
return Blitter_32bppSSE_Base::Encode(sprite_type, sprite, allocator);
|
||||
}
|
||||
|
||||
std::string_view GetName() override { return "32bpp-sse2"; }
|
||||
|
|
|
@ -397,9 +397,9 @@ void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height,
|
|||
}
|
||||
}
|
||||
|
||||
Sprite *Blitter_40bppAnim::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
Sprite *Blitter_40bppAnim::Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
return this->EncodeInternal<false>(sprite, allocator);
|
||||
return this->EncodeInternal<false>(sprite_type, sprite, allocator);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override;
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
size_t BufferSize(uint width, uint height) override;
|
||||
Blitter::PaletteAnimation UsePaletteAnimation() override;
|
||||
bool NeedsAnimationBuffer() override;
|
||||
|
|
|
@ -120,7 +120,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
|
|||
}
|
||||
}
|
||||
|
||||
Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
Sprite *Blitter_8bppOptimized::Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
/* Make memory for all zoom-levels */
|
||||
uint memory = sizeof(SpriteData);
|
||||
|
@ -128,7 +128,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri
|
|||
ZoomLevel zoom_min;
|
||||
ZoomLevel zoom_max;
|
||||
|
||||
if (sprite[ZOOM_LVL_MIN].type == SpriteType::Font) {
|
||||
if (sprite_type == SpriteType::Font) {
|
||||
zoom_min = ZOOM_LVL_MIN;
|
||||
zoom_max = ZOOM_LVL_MIN;
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
};
|
||||
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
|
||||
std::string_view GetName() override { return "8bpp-optimized"; }
|
||||
};
|
||||
|
|
|
@ -61,7 +61,7 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
|
|||
}
|
||||
}
|
||||
|
||||
Sprite *Blitter_8bppSimple::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
Sprite *Blitter_8bppSimple::Encode(SpriteType, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
dest_sprite = allocator.Allocate<Sprite>(sizeof(*dest_sprite) + static_cast<size_t>(sprite[ZOOM_LVL_MIN].height) * static_cast<size_t>(sprite[ZOOM_LVL_MIN].width));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
class Blitter_8bppSimple final : public Blitter_8bppBase {
|
||||
public:
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
|
||||
std::string_view GetName() override { return "8bpp-simple"; }
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
/** Instantiation of the null blitter factory. */
|
||||
static FBlitter_Null iFBlitter_Null;
|
||||
|
||||
Sprite *Blitter_Null::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
Sprite *Blitter_Null::Encode(SpriteType, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
dest_sprite = allocator.Allocate<Sprite>(sizeof(*dest_sprite));
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
uint8_t GetScreenDepth() override { return 0; }
|
||||
void Draw(Blitter::BlitterParams *, BlitterMode, ZoomLevel) override {};
|
||||
void DrawColourMappingRect(void *, int, int, PaletteID) override {};
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
void *MoveTo(void *, int, int) override { return nullptr; };
|
||||
void SetPixel(void *, int, int, uint8_t) override {};
|
||||
void DrawRect(void *, int, int, uint8_t) override {};
|
||||
|
|
|
@ -244,7 +244,6 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa)
|
|||
SpriteLoader::SpriteCollection spritecollection;
|
||||
SpriteLoader::Sprite &sprite = spritecollection[ZOOM_LVL_MIN];
|
||||
sprite.AllocateData(ZOOM_LVL_MIN, static_cast<size_t>(width) * height);
|
||||
sprite.type = SpriteType::Font;
|
||||
sprite.colours = SpriteComponent::Palette;
|
||||
if (aa) sprite.colours.Set(SpriteComponent::Alpha);
|
||||
sprite.width = width;
|
||||
|
@ -274,7 +273,7 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa)
|
|||
}
|
||||
|
||||
UniquePtrSpriteAllocator allocator;
|
||||
BlitterFactory::GetCurrentBlitter()->Encode(spritecollection, allocator);
|
||||
BlitterFactory::GetCurrentBlitter()->Encode(SpriteType::Font, spritecollection, allocator);
|
||||
|
||||
GlyphEntry new_glyph;
|
||||
new_glyph.data = std::move(allocator.data);
|
||||
|
|
|
@ -230,7 +230,6 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa)
|
|||
SpriteLoader::SpriteCollection spritecollection;
|
||||
SpriteLoader::Sprite &sprite = spritecollection[ZOOM_LVL_MIN];
|
||||
sprite.AllocateData(ZOOM_LVL_MIN, width * height);
|
||||
sprite.type = SpriteType::Font;
|
||||
sprite.colours = SpriteComponent::Palette;
|
||||
if (use_aa) sprite.colours.Set(SpriteComponent::Alpha);
|
||||
sprite.width = width;
|
||||
|
@ -278,7 +277,7 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa)
|
|||
}
|
||||
|
||||
UniquePtrSpriteAllocator allocator;
|
||||
BlitterFactory::GetCurrentBlitter()->Encode(spritecollection, allocator);
|
||||
BlitterFactory::GetCurrentBlitter()->Encode(SpriteType::Font, spritecollection, allocator);
|
||||
|
||||
GlyphEntry new_glyph;
|
||||
new_glyph.data = std::move(allocator.data);
|
||||
|
|
|
@ -227,7 +227,6 @@ void Win32FontCache::ClearFontCache()
|
|||
SpriteLoader::SpriteCollection spritecollection;
|
||||
SpriteLoader::Sprite &sprite = spritecollection[ZOOM_LVL_MIN];
|
||||
sprite.AllocateData(ZOOM_LVL_MIN, width * height);
|
||||
sprite.type = SpriteType::Font;
|
||||
sprite.colours = SpriteComponent::Palette;
|
||||
if (aa) sprite.colours.Set(SpriteComponent::Alpha);
|
||||
sprite.width = width;
|
||||
|
@ -266,7 +265,7 @@ void Win32FontCache::ClearFontCache()
|
|||
}
|
||||
|
||||
UniquePtrSpriteAllocator allocator;
|
||||
BlitterFactory::GetCurrentBlitter()->Encode(spritecollection, allocator);
|
||||
BlitterFactory::GetCurrentBlitter()->Encode(SpriteType::Font, spritecollection, allocator);
|
||||
|
||||
GlyphEntry new_glyph;
|
||||
new_glyph.data = std::move(allocator.data);
|
||||
|
|
|
@ -476,7 +476,6 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty
|
|||
uint8_t sprite_avail = 0;
|
||||
uint8_t avail_8bpp = 0;
|
||||
uint8_t avail_32bpp = 0;
|
||||
sprite[ZOOM_LVL_MIN].type = sprite_type;
|
||||
|
||||
SpriteLoaderGrf sprite_loader(file.GetContainerVersion());
|
||||
if (sprite_type != SpriteType::MapGen && encoder->Is32BppSupported()) {
|
||||
|
@ -531,17 +530,12 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty
|
|||
return (void*)GetRawSprite(SPR_IMG_QUERY, SpriteType::Normal, &allocator, encoder);
|
||||
}
|
||||
|
||||
if (sprite[ZOOM_LVL_MIN].type == SpriteType::Font && _font_zoom != ZOOM_LVL_MIN) {
|
||||
if (sprite_type == SpriteType::Font && _font_zoom != ZOOM_LVL_MIN) {
|
||||
/* Make ZOOM_LVL_MIN be ZOOM_LVL_GUI */
|
||||
sprite[ZOOM_LVL_MIN].width = sprite[_font_zoom].width;
|
||||
sprite[ZOOM_LVL_MIN].height = sprite[_font_zoom].height;
|
||||
sprite[ZOOM_LVL_MIN].x_offs = sprite[_font_zoom].x_offs;
|
||||
sprite[ZOOM_LVL_MIN].y_offs = sprite[_font_zoom].y_offs;
|
||||
sprite[ZOOM_LVL_MIN].data = sprite[_font_zoom].data;
|
||||
sprite[ZOOM_LVL_MIN].colours = sprite[_font_zoom].colours;
|
||||
sprite[ZOOM_LVL_MIN] = sprite[_font_zoom];
|
||||
}
|
||||
|
||||
return encoder->Encode(sprite, allocator);
|
||||
return encoder->Encode(sprite_type, sprite, allocator);
|
||||
}
|
||||
|
||||
struct GrfSpriteOffset {
|
||||
|
|
|
@ -49,7 +49,6 @@ public:
|
|||
uint16_t width; ///< Width of the sprite
|
||||
int16_t x_offs; ///< The x-offset of where the sprite will be drawn
|
||||
int16_t y_offs; ///< The y-offset of where the sprite will be drawn
|
||||
SpriteType type; ///< The sprite type
|
||||
SpriteComponents colours; ///< The colour components of the sprite with useful information.
|
||||
SpriteLoader::CommonPixel *data; ///< The sprite itself
|
||||
|
||||
|
@ -124,7 +123,7 @@ public:
|
|||
/**
|
||||
* Convert a sprite from the loader to our own format.
|
||||
*/
|
||||
virtual Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) = 0;
|
||||
virtual Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) = 0;
|
||||
|
||||
/**
|
||||
* Get the value which the height and width on a sprite have to be aligned by.
|
||||
|
|
|
@ -1258,11 +1258,11 @@ void OpenGLBackend::ReleaseAnimBuffer(const Rect &update_rect)
|
|||
}
|
||||
}
|
||||
|
||||
/* virtual */ Sprite *OpenGLBackend::Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
/* virtual */ Sprite *OpenGLBackend::Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)
|
||||
{
|
||||
/* This encoding is only called for mouse cursors. We don't need real sprites but OpenGLSprites to show as cursor. These need to be put in the LRU cache. */
|
||||
OpenGLSpriteAllocator &gl_allocator = static_cast<OpenGLSpriteAllocator&>(allocator);
|
||||
gl_allocator.lru.Insert(gl_allocator.sprite, std::make_unique<OpenGLSprite>(sprite));
|
||||
gl_allocator.lru.Insert(gl_allocator.sprite, std::make_unique<OpenGLSprite>(sprite_type, sprite));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1397,10 +1397,10 @@ void OpenGLBackend::RenderOglSprite(OpenGLSprite *gl_sprite, PaletteID pal, int
|
|||
* Create an OpenGL sprite with a palette remap part.
|
||||
* @param sprite The sprite to create the OpenGL sprite for
|
||||
*/
|
||||
OpenGLSprite::OpenGLSprite(const SpriteLoader::SpriteCollection &sprite) :
|
||||
OpenGLSprite::OpenGLSprite(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite) :
|
||||
dim(sprite[ZOOM_LVL_MIN].width, sprite[ZOOM_LVL_MIN].height), x_offs(sprite[ZOOM_LVL_MIN].x_offs), y_offs(sprite[ZOOM_LVL_MIN].y_offs)
|
||||
{
|
||||
int levels = sprite[ZOOM_LVL_MIN].type == SpriteType::Font ? 1 : ZOOM_LVL_END;
|
||||
int levels = sprite_type == SpriteType::Font ? 1 : ZOOM_LVL_END;
|
||||
assert(levels > 0);
|
||||
(void)_glGetError();
|
||||
|
||||
|
@ -1435,7 +1435,7 @@ OpenGLSprite::OpenGLSprite(const SpriteLoader::SpriteCollection &sprite) :
|
|||
}
|
||||
|
||||
/* Upload texture data. */
|
||||
for (int i = 0; i < (sprite[ZOOM_LVL_MIN].type == SpriteType::Font ? 1 : ZOOM_LVL_END); i++) {
|
||||
for (int i = 0; i < (sprite_type == SpriteType::Font ? 1 : ZOOM_LVL_END); i++) {
|
||||
this->Update(sprite[i].width, sprite[i].height, i, sprite[i].data);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
|
||||
bool Is32BppSupported() override { return true; }
|
||||
uint GetSpriteAlignment() override { return 1u << (ZOOM_LVL_END - 1); }
|
||||
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
Sprite *Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ private:
|
|||
bool BindTextures();
|
||||
|
||||
public:
|
||||
OpenGLSprite(const SpriteLoader::SpriteCollection &sprite);
|
||||
OpenGLSprite(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite);
|
||||
|
||||
/* No support for moving/copying the textures is implemented. */
|
||||
OpenGLSprite(const OpenGLSprite&) = delete;
|
||||
|
|
Loading…
Reference in New Issue