Basic swim GUI for LPC4088
Fork of DMBasicGUI by
Diff: SlideShow/SlideShow.cpp
- Revision:
- 10:651861441108
- Parent:
- 5:f4de114c31c3
- Child:
- 11:265884fa7fdd
--- a/SlideShow/SlideShow.cpp Tue Jan 20 09:05:30 2015 +0100 +++ b/SlideShow/SlideShow.cpp Mon Jan 26 10:06:58 2015 +0100 @@ -317,10 +317,10 @@ memcpy(ss->ImageBackBuffer, CurrentImage->pixels, ss->screenBytes); } - int firstY = 0; - int lastY = NewImage->height; - for (int y = 0, off=0; y < NewImage->height; y++) { - for (int x = 0; x < NewImage->width; x++) { + uint32_t firstY = 0; + uint32_t lastY = NewImage->height; + for (uint32_t y = 0, off=0; y < NewImage->height; y++) { + for (uint32_t x = 0; x < NewImage->width; x++) { off++; if (NewImage->pixels[off] != ss->ImageBackBuffer[off]) { firstY = y; @@ -329,12 +329,12 @@ } } } - for (int y = NewImage->height-1, off=NewImage->height*NewImage->width-1; y > firstY; y--) { - for (int x = 0; x < NewImage->width; x++) { + for (uint32_t y = NewImage->height-1, off=NewImage->height*NewImage->width-1; y > firstY; y--) { + for (uint32_t x = 0; x < NewImage->width; x++) { off--; if (NewImage->pixels[off] != ss->ImageBackBuffer[off]) { lastY = y; - y = -1; + y = firstY; // to break the outer loop as well break; } } @@ -346,9 +346,9 @@ uint16_t* oldImg = CurrentImage==NULL ? &ss->ImageBackBuffer[ss->screenPixels] : &CurrentImage->pixels[firstY*NewImage->width]; uint16_t* newImg = &NewImage->pixels[firstY*NewImage->width]; uint16_t* dstImg = &ss->ImageBackBuffer[firstY*NewImage->width]; - for (int y = firstY; y <= lastY; y++) + for (uint32_t y = firstY; y <= lastY; y++) { - for (int x = 0; x < NewImage->width; x++) + for (uint32_t x = 0; x < NewImage->width; x++) { if (*oldImg != *newImg) { *dstImg = FADE_COMBINE(*oldImg, *newImg, pass); @@ -409,7 +409,7 @@ // Allocate memory to read into *pData = (unsigned char*)malloc(size); if (*pData == NULL) { - printf("Failed to allocate %u bytes to load %s into\n", size, path); + printf("Failed to allocate %lu bytes to load %s into\n", size, path); result = OutOfMemory; break; } @@ -426,7 +426,7 @@ } while ((num > 0) && (size > 0)); if (size != 0) { - printf("Failed to read entire %s, got %u of %ul\n", path, pos, *pSize); + printf("Failed to read entire %s, got %lu of %lu\n", path, pos, *pSize); result = FileError; break; }