Skip to content

Commit 7700923

Browse files
[ui_sdl] use COLORS
1 parent 1d7d996 commit 7700923

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/ui_sdl.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static void write_text( int x, int y, const char* string, unsigned int length, u
137137
}
138138
}
139139

140-
static void colors_setup( color_t* colors )
140+
static void colors_setup( void )
141141
{
142142
int r, g, b;
143143
// Adjust the LCD color according to the contrast
@@ -149,25 +149,25 @@ static void colors_setup( color_t* colors )
149149

150150
for ( unsigned i = FIRST_COLOR; i < LAST_COLOR; i++ ) {
151151
if ( config.mono ) {
152-
r = colors[ i ].mono_rgb;
153-
g = colors[ i ].mono_rgb;
154-
b = colors[ i ].mono_rgb;
152+
r = COLORS[ i ].mono_rgb;
153+
g = COLORS[ i ].mono_rgb;
154+
b = COLORS[ i ].mono_rgb;
155155
} else if ( config.gray ) {
156-
r = colors[ i ].gray_rgb;
157-
g = colors[ i ].gray_rgb;
158-
b = colors[ i ].gray_rgb;
156+
r = COLORS[ i ].gray_rgb;
157+
g = COLORS[ i ].gray_rgb;
158+
b = COLORS[ i ].gray_rgb;
159159
} else {
160-
r = colors[ i ].r;
161-
g = colors[ i ].g;
162-
b = colors[ i ].b;
160+
r = COLORS[ i ].r;
161+
g = COLORS[ i ].g;
162+
b = COLORS[ i ].b;
163163
}
164164

165165
ARGBColors[ i ] = 0xff000000 | ( r << 16 ) | ( g << 8 ) | b;
166166
}
167167

168-
r = ( 0x13 - contrast ) * ( colors[ LCD ].r / 0x10 );
169-
g = ( 0x13 - contrast ) * ( colors[ LCD ].g / 0x10 );
170-
b = 128 - ( ( 0x13 - contrast ) * ( ( 128 - colors[ LCD ].b ) / 0x10 ) );
168+
r = ( 0x13 - contrast ) * ( COLORS[ LCD ].r / 0x10 );
169+
g = ( 0x13 - contrast ) * ( COLORS[ LCD ].g / 0x10 );
170+
b = 128 - ( ( 0x13 - contrast ) * ( ( 128 - COLORS[ LCD ].b ) / 0x10 ) );
171171
ARGBColors[ PIXEL ] = 0xff000000 | ( r << 16 ) | ( g << 8 ) | b;
172172
}
173173

@@ -1355,11 +1355,10 @@ void sdl_update_LCD( void )
13551355
{
13561356
if ( display.on ) {
13571357
int i;
1358-
long addr;
1358+
long addr = display.disp_start;
13591359
static int old_offset = -1;
13601360
static int old_lines = -1;
13611361

1362-
addr = display.disp_start;
13631362
if ( display.offset != old_offset ) {
13641363
memset( lcd_nibbles_buffer, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
13651364
old_offset = display.offset;
@@ -1453,7 +1452,7 @@ void sdl_draw_annunc( void )
14531452

14541453
void sdl_adjust_contrast( void )
14551454
{
1456-
colors_setup( opt_gx ? colors_gx : colors_sx );
1455+
colors_setup();
14571456
create_annunc();
14581457

14591458
// redraw LCD
@@ -1534,7 +1533,7 @@ void init_sdl_ui( int argc, char** argv )
15341533

15351534
/* BUTTONS = opt_gx ? BUTTONS_gx : BUTTONS_sx; */
15361535

1537-
colors_setup( COLORS );
1536+
colors_setup();
15381537

15391538
if ( !config.hide_chrome ) {
15401539
int cut = BUTTONS[ HPKEY_MTH ].y + KEYBOARD_OFFSET_Y - 19;

0 commit comments

Comments
 (0)