From e5a837ee3a0231c6d4623d138e875908dcd4bf56 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 3 May 2012 23:06:37 +0000 Subject: [PATCH] Fix a positioning problem in CRlePaletteBitmap git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4694 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- NxWidgets/ChangeLog.txt | 2 ++ NxWidgets/UnitTests/nxwm/main.cxx | 2 +- NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index 18bbffd6c0..000fe2cda3 100755 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -20,3 +20,5 @@ out in the 1.0 release but is verfied functional in 1.1. * CRlePalettBitmap: Fix an error in the text that determines if we need to "rewind" to the beginning of the image. +* CRlePalettBitmap: Fixe a positioning problem. It was actually losing + the last row of every image! diff --git a/NxWidgets/UnitTests/nxwm/main.cxx b/NxWidgets/UnitTests/nxwm/main.cxx index c202e6443d..6a62661417 100644 --- a/NxWidgets/UnitTests/nxwm/main.cxx +++ b/NxWidgets/UnitTests/nxwm/main.cxx @@ -274,7 +274,7 @@ int MAIN_NAME(int argc, char *argv[]) delete g_nxwmtest.taskbar; return EXIT_FAILURE; } - showTestCaseMemory("After initializing memory menager"); + showTestCaseMemory("After initializing window manager"); // Create the start window. The general sequence for setting up the start window is: // diff --git a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx index 31e300269d..4c781e2c98 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; }