Fix case where stride != width

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2683 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-05-16 19:37:21 +00:00
parent 36e5da2751
commit 12daeb5fdf
1 changed files with 15 additions and 10 deletions

View File

@ -185,7 +185,7 @@ int NXF_FUNCNAME(nxf_convert,NXFONTS_SUFFIX)
for (row = 0; row < height; row++) for (row = 0; row < height; row++)
{ {
/* Process each byte in the glyph */ /* Process each byte in the glyph row */
col = 0; col = 0;
dptr = (FAR NXF_PIXEL_T*)line; dptr = (FAR NXF_PIXEL_T*)line;
@ -197,7 +197,7 @@ int NXF_FUNCNAME(nxf_convert,NXFONTS_SUFFIX)
{ {
bmbyte = *sptr++; bmbyte = *sptr++;
/* Process each bit in the byte */ /* Process each bit in one byte */
for (bmbit = 7; bmbit >= 0 && col < width; bmbit--, col++) for (bmbit = 7; bmbit >= 0 && col < width; bmbit--, col++)
{ {
@ -224,16 +224,21 @@ int NXF_FUNCNAME(nxf_convert,NXFONTS_SUFFIX)
nbits = 0; nbits = 0;
} }
} }
}
/* Handle any fractional bytes at the end */ /* The entire glyph row has been rendered. Handle any fractional bytes at
* the end of the row
*/
if (nbits > 0) if (nbits > 0)
{ {
*dptr = pixel; *dptr = pixel;
} }
/* Point to the beginning of the next row */
line += stride; line += stride;
} }
}
#else #else
/* Handle each row in both the input and output */ /* Handle each row in both the input and output */