diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-03 23:06:37 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-03 23:06:37 +0000 |
commit | aaf45d80e084cf715374b0b6a8833a8d938c7585 (patch) | |
tree | 4ec150b3a36e11bdf27370c1f17f51125cbeb2bb /NxWidgets/libnxwidgets | |
parent | 7fb45f7b0753769e803bf5de5b2df638b41d07d6 (diff) | |
download | nuttx-aaf45d80e084cf715374b0b6a8833a8d938c7585.tar.gz nuttx-aaf45d80e084cf715374b0b6a8833a8d938c7585.tar.bz2 nuttx-aaf45d80e084cf715374b0b6a8833a8d938c7585.zip |
Fix a positioning problem in CRlePaletteBitmap
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4694 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets')
-rw-r--r-- | NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx index 31e300269..4c781e2c9 100644 --- a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx +++ b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx @@ -242,12 +242,22 @@ void CRlePaletteBitmap::startOfImage(void) bool CRlePaletteBitmap::advancePosition(nxgl_coord_t npixels) { + // Advance to the next column after consuming 'npixels' on this colum int newcol = m_col + npixels; + // Have we consumed the entire row? + while (newcol >= m_bitmap->width) { + // Advance to the next row + newcol -= m_bitmap->width; - if (++m_row >= m_bitmap->height) + m_row++; + + // If we still have pixels to account for but we have exceeded the + // the size of the bitmap, then return false + + if (newcol > 0 && m_row >= m_bitmap->height) { return false; } |