Remove: ZOOM_LVL_COUNT

This is the only enumeration with a COUNT and END. The logic of the COUNT
implied that BEGIN could be non-zero, but all but two uses of zoom level
assume that BEGIN is zero, making the separate count only confusing.
This commit is contained in:
rubidium42
2023-11-29 20:29:23 -04:00
committed by rubidium42
parent ddd609ce9b
commit cb8612ba79
11 changed files with 16 additions and 18 deletions

View File

@@ -1270,10 +1270,10 @@ void OpenGLBackend::ReleaseAnimBuffer(const Rect &update_rect)
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sizeof(OpenGLSprite));
OpenGLSprite *gl_sprite = (OpenGLSprite *)dest_sprite->data;
new (gl_sprite) OpenGLSprite(sprite->width, sprite->height, sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_COUNT, sprite->colours);
new (gl_sprite) OpenGLSprite(sprite->width, sprite->height, sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_END, sprite->colours);
/* Upload texture data. */
for (int i = 0; i < (sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_COUNT); i++) {
for (int i = 0; i < (sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_END); i++) {
gl_sprite->Update(sprite[i].width, sprite[i].height, i, sprite[i].data);
}
@@ -1323,7 +1323,7 @@ void OpenGLBackend::RenderOglSprite(OpenGLSprite *gl_sprite, PaletteID pal, int
Dimension dim = gl_sprite->GetSize(zoom);
_glUseProgram(this->sprite_program);
_glUniform4f(this->sprite_sprite_loc, (float)x, (float)y, (float)dim.width, (float)dim.height);
_glUniform1f(this->sprite_zoom_loc, (float)(zoom - ZOOM_LVL_BEGIN));
_glUniform1f(this->sprite_zoom_loc, (float)zoom);
_glUniform2f(this->sprite_screen_loc, (float)_screen.width, (float)_screen.height);
_glUniform1i(this->sprite_rgb_loc, rgb ? 1 : 0);
_glUniform1i(this->sprite_crash_loc, pal == PALETTE_CRASH ? 1 : 0);

View File

@@ -108,7 +108,7 @@ public:
/* SpriteEncoder */
bool Is32BppSupported() override { return true; }
uint GetSpriteAlignment() override { return 1u << (ZOOM_LVL_COUNT - 1); }
uint GetSpriteAlignment() override { return 1u << (ZOOM_LVL_END - 1); }
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
};