Switch gr_internal_string0_template to count down loop

This commit is contained in:
Kp 2015-05-09 17:39:02 +00:00
parent 6d9de0d177
commit 4228ed2324

View file

@ -188,7 +188,7 @@ static int gr_internal_string0_template(int x, int y, const char *s)
{ {
unsigned char * fp; unsigned char * fp;
const char * text_ptr, * next_row, * text_ptr1; const char * text_ptr, * next_row, * text_ptr1;
int BitMask,bits, letter, underline; int BitMask,bits, underline;
int skip_lines = 0; int skip_lines = 0;
unsigned int VideoOffset, VideoOffset1; unsigned int VideoOffset, VideoOffset1;
@ -251,7 +251,7 @@ static int gr_internal_string0_template(int x, int y, const char *s)
const auto &width = result.width; const auto &width = result.width;
const auto &spacing = result.spacing; const auto &spacing = result.spacing;
letter = (unsigned char)*text_ptr - grd_curcanv->cv_font->ft_minchar; const unsigned letter = static_cast<unsigned char>(*text_ptr) - grd_curcanv->cv_font->ft_minchar;
if (masked_draws_background) if (masked_draws_background)
{ {
@ -289,7 +289,7 @@ static int gr_internal_string0_template(int x, int y, const char *s)
BitMask = 0; BitMask = 0;
for (int i=0; i< width; i++ ) for (uint_fast32_t i = width; i--; ++VideoOffset, BitMask >>= 1)
{ {
if (BitMask==0) { if (BitMask==0) {
bits = *fp++; bits = *fp++;
@ -297,19 +297,17 @@ static int gr_internal_string0_template(int x, int y, const char *s)
} }
if (bits & BitMask) if (bits & BitMask)
DATA[VideoOffset++] = (unsigned char) grd_curcanv->cv_font_fg_color; DATA[VideoOffset] = static_cast<uint8_t>(grd_curcanv->cv_font_fg_color);
else else
{ {
if (masked_draws_background) if (masked_draws_background)
{ {
DATA[VideoOffset++] = static_cast<unsigned char>(grd_curcanv->cv_font_bg_color); DATA[VideoOffset] = static_cast<uint8_t>(grd_curcanv->cv_font_bg_color);
} }
else else
{ {
VideoOffset++;
} }
} }
BitMask >>= 1;
} }
} }
text_ptr++; text_ptr++;