A basic graphics package for the LPC4088 Display Module.

Dependents:   lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more

Fork of DMBasicGUI by EmbeddedArtists AB

Files at this revision

API Documentation at this revision

Comitter:
embeddedartists
Date:
Mon Jan 26 10:06:58 2015 +0100
Parent:
9:ce69a7adfe9c
Child:
11:265884fa7fdd
Commit message:
- Added virtual destructors to avoid undefined behaviour
- Fixed compiler warnings

Changed in this revision

Application/App.h Show annotated file Show diff for this revision Revisions of this file
Application/AppColorPicker.h Show annotated file Show diff for this revision Revisions of this file
Application/AppLauncher.h Show annotated file Show diff for this revision Revisions of this file
Application/AppTouchCalibration.h Show annotated file Show diff for this revision Revisions of this file
Application/Button.h Show annotated file Show diff for this revision Revisions of this file
Application/Clickable.h Show annotated file Show diff for this revision Revisions of this file
Application/DigitButton.cpp Show annotated file Show diff for this revision Revisions of this file
Application/DigitButton.h Show annotated file Show diff for this revision Revisions of this file
Application/Image.cpp Show annotated file Show diff for this revision Revisions of this file
Application/ImageButton.h Show annotated file Show diff for this revision Revisions of this file
Application/bmp.cpp Show annotated file Show diff for this revision Revisions of this file
SlideShow/AppSlideShow.h Show annotated file Show diff for this revision Revisions of this file
SlideShow/SlideShow.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Application/App.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/App.h	Mon Jan 26 10:06:58 2015 +0100
@@ -31,6 +31,7 @@
  */
 class App {
 public:
+	virtual ~App() {};
 
     /** Prepare the App before it is started.
      *
--- a/Application/AppColorPicker.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/AppColorPicker.h	Mon Jan 26 10:06:58 2015 +0100
@@ -34,7 +34,7 @@
 public:
 
 	AppColorPicker();
-	~AppColorPicker();
+	virtual ~AppColorPicker();
 
     virtual bool setup();
     virtual void runToCompletion();
--- a/Application/AppLauncher.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/AppLauncher.h	Mon Jan 26 10:06:58 2015 +0100
@@ -34,7 +34,7 @@
 public:
 
 	AppLauncher();
-	~AppLauncher();
+	virtual ~AppLauncher();
 
     enum CommonApplicationIDs {
         CalibrationApp = 0xffff,
--- a/Application/AppTouchCalibration.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/AppTouchCalibration.h	Mon Jan 26 10:06:58 2015 +0100
@@ -35,7 +35,7 @@
 public:
 
 	AppTouchCalibration();
-	~AppTouchCalibration();
+	virtual ~AppTouchCalibration();
 
     virtual bool setup();
     virtual void runToCompletion();
--- a/Application/Button.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/Button.h	Mon Jan 26 10:06:58 2015 +0100
@@ -79,6 +79,7 @@
      *  @param height  the height of the button
      */
   Button(const char* caption, COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
+  virtual ~Button() {};
   
     /** Changes the caption
      *
--- a/Application/Clickable.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/Clickable.h	Mon Jan 26 10:06:58 2015 +0100
@@ -37,6 +37,7 @@
      *  @param height  the height of the button
      */
   Clickable(COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
+  virtual ~Clickable() {};
   
     /** Set the function to call when  clicked
      *
--- a/Application/DigitButton.cpp	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/DigitButton.cpp	Mon Jan 26 10:06:58 2015 +0100
@@ -158,7 +158,7 @@
       x = 0;
     }
     int y = (_win.yvsize - _img_digit_height)/2;
-    for (int i = 0; i < _digits; i++) {
+    for (unsigned int i = 0; i < _digits; i++) {
       uint32_t off = (v % 10)*_img_digit_size + _img_y_offset*_img_digit_width;
       swim_put_image_xy(&_win, _imgUp.pixels+off, _img_digit_width, _img_digit_height, x+(_digits-i-1)*_img_digit_width, y);
       v = v/10;
--- a/Application/DigitButton.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/DigitButton.h	Mon Jan 26 10:06:58 2015 +0100
@@ -38,7 +38,7 @@
      *  @param height  the height of the button
      */
   DigitButton(COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
-  ~DigitButton();
+  virtual ~DigitButton();
 
     /** Loads the mandatory "normal" state image and the optional "pressed" state image
      *
--- a/Application/Image.cpp	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/Image.cpp	Mon Jan 26 10:06:58 2015 +0100
@@ -64,11 +64,11 @@
     case PNG:
     {
       unsigned char* pTmp;
-      unsigned error = lodepng_decode24(&pTmp, &pDataOut->width, &pDataOut->height, pDataIn, sizeIn);
+      unsigned error = lodepng_decode24(&pTmp, (unsigned*)&pDataOut->width, (unsigned*)&pDataOut->height, pDataIn, sizeIn);
       pDataOut->res = resolution;
       if (error == 0)
       {
-        int x, y;
+        uint32_t x, y;
         uint8_t r;
         uint8_t g;
         uint8_t b;
--- a/Application/ImageButton.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/ImageButton.h	Mon Jan 26 10:06:58 2015 +0100
@@ -38,7 +38,7 @@
      *  @param height  the height of the button
      */
   ImageButton(COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
-  ~ImageButton();
+  virtual ~ImageButton();
 
     /** Loads the mandatory "normal" state image and the optional "pressed" state image
      *
--- a/Application/bmp.cpp	Tue Jan 20 09:05:30 2015 +0100
+++ b/Application/bmp.cpp	Mon Jan 26 10:06:58 2015 +0100
@@ -150,7 +150,7 @@
 #if 1
             if (target_bpp == 16) {
                 // Modified by Embedded Artists to convert to 565-format instead of 24 bit
-                for(int x=0; x<width; x++)
+                for(unsigned int x=0; x<width; x++)
                 {          
                     r = *(unsigned char *)(image + (height - i - 1) * rowWidthBytes + 3*x + 2);
                     g = *(unsigned char *)(image + (height - i - 1) * rowWidthBytes + 3*x + 1);
@@ -161,7 +161,7 @@
                 }
             } else {
                 // Modified by Embedded Artists to add alpha channel in 24 bit output
-                for(int x=0; x<width; x++)
+                for(unsigned int x=0; x<width; x++)
                 {          
                     r = *(unsigned char *)(image + (height - i - 1) * rowWidthBytes + 3*x + 2);
                     g = *(unsigned char *)(image + (height - i - 1) * rowWidthBytes + 3*x + 1);
--- a/SlideShow/AppSlideShow.h	Tue Jan 20 09:05:30 2015 +0100
+++ b/SlideShow/AppSlideShow.h	Mon Jan 26 10:06:58 2015 +0100
@@ -31,7 +31,7 @@
 public:
 
 	AppSlideShow();
-	~AppSlideShow();
+	virtual ~AppSlideShow();
 
     virtual bool setup();
     virtual void runToCompletion();
--- 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;
         }