mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use enum class for PaletteAnimation.
parent
161b02efda
commit
1e14fd6a0d
|
@ -532,7 +532,7 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
|
|||
|
||||
Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation()
|
||||
{
|
||||
return Blitter::PALETTE_ANIMATION_BLITTER;
|
||||
return Blitter::PaletteAnimation::Blitter;
|
||||
}
|
||||
|
||||
void Blitter_32bppAnim::PostResize()
|
||||
|
|
|
@ -152,5 +152,5 @@ void Blitter_32bppBase::PaletteAnimate(const Palette &)
|
|||
|
||||
Blitter::PaletteAnimation Blitter_32bppBase::UsePaletteAnimation()
|
||||
{
|
||||
return Blitter::PALETTE_ANIMATION_NONE;
|
||||
return Blitter::PaletteAnimation::None;
|
||||
}
|
||||
|
|
|
@ -528,7 +528,7 @@ size_t Blitter_40bppAnim::BufferSize(uint width, uint height)
|
|||
|
||||
Blitter::PaletteAnimation Blitter_40bppAnim::UsePaletteAnimation()
|
||||
{
|
||||
return Blitter::PALETTE_ANIMATION_VIDEO_BACKEND;
|
||||
return Blitter::PaletteAnimation::VideoBackend;
|
||||
}
|
||||
|
||||
bool Blitter_40bppAnim::NeedsAnimationBuffer()
|
||||
|
|
|
@ -156,5 +156,5 @@ void Blitter_8bppBase::PaletteAnimate(const Palette &)
|
|||
|
||||
Blitter::PaletteAnimation Blitter_8bppBase::UsePaletteAnimation()
|
||||
{
|
||||
return Blitter::PALETTE_ANIMATION_VIDEO_BACKEND;
|
||||
return Blitter::PaletteAnimation::VideoBackend;
|
||||
}
|
||||
|
|
|
@ -47,10 +47,10 @@ public:
|
|||
};
|
||||
|
||||
/** Types of palette animation. */
|
||||
enum PaletteAnimation {
|
||||
PALETTE_ANIMATION_NONE, ///< No palette animation
|
||||
PALETTE_ANIMATION_VIDEO_BACKEND, ///< Palette animation should be done by video backend (8bpp only!)
|
||||
PALETTE_ANIMATION_BLITTER, ///< The blitter takes care of the palette animation
|
||||
enum class PaletteAnimation : uint8_t {
|
||||
None, ///< No palette animation
|
||||
VideoBackend, ///< Palette animation should be done by video backend (8bpp only!)
|
||||
Blitter, ///< The blitter takes care of the palette animation
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void ScrollBuffer(void *, int &, int &, int &, int &, int, int) override {};
|
||||
size_t BufferSize(uint, uint) override { return 0; };
|
||||
void PaletteAnimate(const Palette &) override { };
|
||||
Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; };
|
||||
Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PaletteAnimation::None; };
|
||||
|
||||
std::string_view GetName() override { return "null"; }
|
||||
};
|
||||
|
|
|
@ -257,7 +257,7 @@ void DoPaletteAnimations()
|
|||
const uint old_tc = palette_animation_counter;
|
||||
uint j;
|
||||
|
||||
if (blitter != nullptr && blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_NONE) {
|
||||
if (blitter != nullptr && blitter->UsePaletteAnimation() == Blitter::PaletteAnimation::None) {
|
||||
palette_animation_counter = 0;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ void DoPaletteAnimations()
|
|||
if (j >= EPV_CYCLES_GLITTER_WATER) j -= EPV_CYCLES_GLITTER_WATER;
|
||||
}
|
||||
|
||||
if (blitter != nullptr && blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_NONE) {
|
||||
if (blitter != nullptr && blitter->UsePaletteAnimation() == Blitter::PaletteAnimation::None) {
|
||||
palette_animation_counter = old_tc;
|
||||
} else if (_cur_palette.count_dirty == 0 && memcmp(old_val, &_cur_palette.palette[PALETTE_ANIM_START], sizeof(old_val)) != 0) {
|
||||
/* Did we changed anything on the palette? Seems so. Mark it as dirty */
|
||||
|
|
|
@ -102,15 +102,15 @@ void VideoDriver_Allegro::CheckPaletteAnim()
|
|||
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
||||
|
||||
switch (blitter->UsePaletteAnimation()) {
|
||||
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
|
||||
case Blitter::PaletteAnimation::VideoBackend:
|
||||
UpdatePalette(_local_palette.first_dirty, _local_palette.count_dirty);
|
||||
break;
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_BLITTER:
|
||||
case Blitter::PaletteAnimation::Blitter:
|
||||
blitter->PaletteAnimate(_local_palette);
|
||||
break;
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_NONE:
|
||||
case Blitter::PaletteAnimation::None:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -321,7 +321,7 @@ void VideoDriver_CocoaOpenGL::Paint()
|
|||
/* Always push a changed palette to OpenGL. */
|
||||
CGLSetCurrentContext(this->gl_context);
|
||||
OpenGLBackend::Get()->UpdatePalette(_local_palette.palette, _local_palette.first_dirty, _local_palette.count_dirty);
|
||||
if (blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_BLITTER) {
|
||||
if (blitter->UsePaletteAnimation() == Blitter::PaletteAnimation::Blitter) {
|
||||
blitter->PaletteAnimate(_local_palette);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -736,15 +736,15 @@ void VideoDriver_CocoaQuartz::CheckPaletteAnim()
|
|||
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
||||
|
||||
switch (blitter->UsePaletteAnimation()) {
|
||||
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
|
||||
case Blitter::PaletteAnimation::VideoBackend:
|
||||
this->UpdatePalette(_local_palette.first_dirty, _local_palette.count_dirty);
|
||||
break;
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_BLITTER:
|
||||
case Blitter::PaletteAnimation::Blitter:
|
||||
blitter->PaletteAnimate(_local_palette);
|
||||
break;
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_NONE:
|
||||
case Blitter::PaletteAnimation::None:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -101,16 +101,16 @@ void VideoDriver_SDL_Default::Paint()
|
|||
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
||||
|
||||
switch (blitter->UsePaletteAnimation()) {
|
||||
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
|
||||
case Blitter::PaletteAnimation::VideoBackend:
|
||||
this->UpdatePalette();
|
||||
break;
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_BLITTER: {
|
||||
case Blitter::PaletteAnimation::Blitter: {
|
||||
blitter->PaletteAnimate(this->local_palette);
|
||||
break;
|
||||
}
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_NONE:
|
||||
case Blitter::PaletteAnimation::None:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -180,7 +180,7 @@ void VideoDriver_SDL_OpenGL::Paint()
|
|||
|
||||
/* Always push a changed palette to OpenGL. */
|
||||
OpenGLBackend::Get()->UpdatePalette(this->local_palette.palette, this->local_palette.first_dirty, this->local_palette.count_dirty);
|
||||
if (blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_BLITTER) {
|
||||
if (blitter->UsePaletteAnimation() == Blitter::PaletteAnimation::Blitter) {
|
||||
blitter->PaletteAnimate(this->local_palette);
|
||||
}
|
||||
|
||||
|
|
|
@ -1242,16 +1242,16 @@ void VideoDriver_Win32GDI::Paint()
|
|||
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
||||
|
||||
switch (blitter->UsePaletteAnimation()) {
|
||||
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
|
||||
case Blitter::PaletteAnimation::VideoBackend:
|
||||
this->UpdatePalette(dc2, _local_palette.first_dirty, _local_palette.count_dirty);
|
||||
break;
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_BLITTER: {
|
||||
case Blitter::PaletteAnimation::Blitter: {
|
||||
blitter->PaletteAnimate(_local_palette);
|
||||
break;
|
||||
}
|
||||
|
||||
case Blitter::PALETTE_ANIMATION_NONE:
|
||||
case Blitter::PaletteAnimation::None:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1586,7 +1586,7 @@ void VideoDriver_Win32OpenGL::Paint()
|
|||
|
||||
/* Always push a changed palette to OpenGL. */
|
||||
OpenGLBackend::Get()->UpdatePalette(_local_palette.palette, _local_palette.first_dirty, _local_palette.count_dirty);
|
||||
if (blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_BLITTER) {
|
||||
if (blitter->UsePaletteAnimation() == Blitter::PaletteAnimation::Blitter) {
|
||||
blitter->PaletteAnimate(_local_palette);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue