sources/coloredline.cpp

changeset 100
d301ead29d7c
parent 88
08ccaf26cffd
child 106
7b156b764d11
child 109
e4966d7e615d
--- a/sources/coloredline.cpp	Fri Jul 24 00:43:16 2015 +0300
+++ b/sources/coloredline.cpp	Fri Jul 24 04:24:38 2015 +0300
@@ -137,19 +137,8 @@
 //
 void ColoredLine::set_color (Color a, bool on)
 {
-	switch (a)
-	{
-	case BLACK:   m_data << (on ? RLINE_ON_BLACK   : RLINE_OFF_BLACK); break;
-	case RED:     m_data << (on ? RLINE_ON_RED     : RLINE_OFF_RED); break;
-	case GREEN:   m_data << (on ? RLINE_ON_GREEN   : RLINE_OFF_GREEN); break;
-	case YELLOW:  m_data << (on ? RLINE_ON_YELLOW  : RLINE_OFF_YELLOW); break;
-	case BLUE:    m_data << (on ? RLINE_ON_BLUE    : RLINE_OFF_BLUE); break;
-	case MAGENTA: m_data << (on ? RLINE_ON_MAGENTA : RLINE_OFF_MAGENTA); break;
-	case CYAN:    m_data << (on ? RLINE_ON_CYAN    : RLINE_OFF_CYAN); break;
-	case WHITE:   m_data << (on ? RLINE_ON_WHITE   : RLINE_OFF_WHITE); break;
-	case NUM_COLORS:
-	case DEFAULT: assert (false); break;
-	}
+	assert (a < 8);
+	m_data << (a + (on ? RLINE_ON_COLOR : RLINE_OFF_COLOR));
 }
 
 // -------------------------------------------------------------------------------------------------

mercurial