polygon: fix sign-compare warnings

This commit is contained in:
Benjamin Valentin 2023-02-17 14:19:17 +01:00
parent 3500b1056b
commit aaeafe0dd0
1 changed files with 5 additions and 5 deletions

View File

@ -216,17 +216,17 @@ static void pg_hline(pg_struct *pg, u8g2_t *u8g2)
if ( y < 0 )
return;
if ( y >= u8g2_GetDisplayHeight(u8g2) ) // does not work for 256x64 display???
if ( y >= (pg_word_t)u8g2_GetDisplayHeight(u8g2) ) // does not work for 256x64 display???
return;
if ( x1 < x2 )
{
if ( x2 < 0 )
return;
if ( x1 >= u8g2_GetDisplayWidth(u8g2) )
if ( x1 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
return;
if ( x1 < 0 )
x1 = 0;
if ( x2 >= u8g2_GetDisplayWidth(u8g2) )
if ( x2 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
x2 = u8g2_GetDisplayWidth(u8g2);
u8g2_DrawHLine(u8g2, x1, y, x2 - x1);
}
@ -234,11 +234,11 @@ static void pg_hline(pg_struct *pg, u8g2_t *u8g2)
{
if ( x1 < 0 )
return;
if ( x2 >= u8g2_GetDisplayWidth(u8g2) )
if ( x2 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
return;
if ( x2 < 0 )
x1 = 0;
if ( x1 >= u8g2_GetDisplayWidth(u8g2) )
if ( x1 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
x1 = u8g2_GetDisplayWidth(u8g2);
u8g2_DrawHLine(u8g2, x2, y, x1 - x2);
}