From b000887f76b183ada29736e28dcec985624abd73 Mon Sep 17 00:00:00 2001 From: sukibaby <163092272+sukibaby@users.noreply.github.com> Date: Sat, 14 Sep 2024 02:59:55 -0700 Subject: [PATCH] Remove some macros related to Rainbow Mode Should help allowing the compiler to properly optimize this operation, as these macros are only used here. --- src/BitmapText.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/BitmapText.cpp b/src/BitmapText.cpp index c845a51e5a..5349ebb659 100644 --- a/src/BitmapText.cpp +++ b/src/BitmapText.cpp @@ -28,8 +28,6 @@ REGISTER_ACTOR_CLASS( BitmapText ); * a waste, when we're usually setting them all to the same value. Rainbow and * fading are annoying to optimize, but rarely used. Iterating over every * character in Draw() is dumb. */ -#define NUM_RAINBOW_COLORS THEME->GetMetricI("BitmapText","NumRainbowColors") -#define RAINBOW_COLOR(n) THEME->GetMetricC("BitmapText",ssprintf("RainbowColor%i", n+1)) static std::vector RAINBOW_COLORS; @@ -40,9 +38,11 @@ BitmapText::BitmapText() static int iReloadCounter = 0; if( iReloadCounter % 20==0 ) { - RAINBOW_COLORS.resize( NUM_RAINBOW_COLORS ); - for( unsigned i = 0; i < RAINBOW_COLORS.size(); ++i ) - RAINBOW_COLORS[i] = RAINBOW_COLOR(i); + RAINBOW_COLORS.resize(THEME->GetMetricI("BitmapText", "NumRainbowColors")); + for (unsigned i = 0; i < RAINBOW_COLORS.size(); ++i) + { + RAINBOW_COLORS[i] = THEME->GetMetricC("BitmapText", ssprintf("RainbowColor%i", i + 1)); + } } iReloadCounter++;