summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/palette.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/palette.cpp')
-rw-r--r--src/lib/util/palette.cpp42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/lib/util/palette.cpp b/src/lib/util/palette.cpp
index f1a6a002ce9..488f7f8a2d2 100644
--- a/src/lib/util/palette.cpp
+++ b/src/lib/util/palette.cpp
@@ -348,10 +348,12 @@ void palette_t::set_gamma(float gamma)
void palette_t::entry_set_color(uint32_t index, rgb_t rgb)
{
- // if out of range, or unchanged, ignore
- if (index >= m_numcolors || m_entry_color[index] == rgb)
+ // if unchanged, ignore
+ if (m_entry_color[index] == rgb)
return;
+ assert(index < m_numcolors);
+
// set the color
m_entry_color[index] = rgb;
@@ -368,10 +370,12 @@ void palette_t::entry_set_color(uint32_t index, rgb_t rgb)
void palette_t::entry_set_red_level(uint32_t index, uint8_t level)
{
- // if out of range, or unchanged, ignore
- if (index >= m_numcolors || m_entry_color[index].r() == level)
+ // if unchanged, ignore
+ if (m_entry_color[index].r() == level)
return;
+ assert(index < m_numcolors);
+
// set the level
m_entry_color[index].set_r(level);
@@ -388,10 +392,12 @@ void palette_t::entry_set_red_level(uint32_t index, uint8_t level)
void palette_t::entry_set_green_level(uint32_t index, uint8_t level)
{
- // if out of range, or unchanged, ignore
- if (index >= m_numcolors || m_entry_color[index].g() == level)
+ // if unchanged, ignore
+ if (m_entry_color[index].g() == level)
return;
+ assert(index < m_numcolors);
+
// set the level
m_entry_color[index].set_g(level);
@@ -408,10 +414,12 @@ void palette_t::entry_set_green_level(uint32_t index, uint8_t level)
void palette_t::entry_set_blue_level(uint32_t index, uint8_t level)
{
- // if out of range, or unchanged, ignore
- if (index >= m_numcolors || m_entry_color[index].b() == level)
+ // if unchanged, ignore
+ if (m_entry_color[index].b() == level)
return;
+ assert(index < m_numcolors);
+
// set the level
m_entry_color[index].set_b(level);
@@ -428,10 +436,12 @@ void palette_t::entry_set_blue_level(uint32_t index, uint8_t level)
void palette_t::entry_set_contrast(uint32_t index, float contrast)
{
- // if out of range, or unchanged, ignore
- if (index >= m_numcolors || m_entry_contrast[index] == contrast)
+ // if unchanged, ignore
+ if (m_entry_contrast[index] == contrast)
return;
+ assert(index < m_numcolors);
+
// set the contrast
m_entry_contrast[index] = contrast;
@@ -451,8 +461,10 @@ void palette_t::group_set_brightness(uint32_t group, float brightness)
// convert incoming value to normalized result
brightness = (brightness - 1.0f) * 256.0f;
- // if out of range, or unchanged, ignore
- if (group >= m_numgroups || m_group_bright[group] == brightness)
+ assert(group < m_numgroups);
+
+ // if unchanged, ignore
+ if (m_group_bright[group] == brightness)
return;
// set the contrast
@@ -471,10 +483,12 @@ void palette_t::group_set_brightness(uint32_t group, float brightness)
void palette_t::group_set_contrast(uint32_t group, float contrast)
{
- // if out of range, or unchanged, ignore
- if (group >= m_numgroups || m_group_contrast[group] == contrast)
+ // if unchanged, ignore
+ if (m_group_contrast[group] == contrast)
return;
+ assert(group < m_numgroups);
+
// set the contrast
m_group_contrast[group] = contrast;