Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.
Dependents: FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more
Fork of SPI_TFT by
See Components - RA8875 Based Display
Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.
Offline Help Manual (Windows chm)
/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)
Diff: GraphicsDisplay.cpp
- Revision:
- 145:5eb2492acdda
- Parent:
- 136:224e03d5c31f
- Child:
- 146:373d59f08357
--- a/GraphicsDisplay.cpp Thu Dec 29 20:06:00 2016 +0000 +++ b/GraphicsDisplay.cpp Sat May 06 20:27:44 2017 +0000 @@ -9,6 +9,12 @@ #include "Bitmap.h" #include "string.h" +//#include "Utility.h" // private memory manager +#ifndef UTILITY_H +#define swMalloc malloc // use the standard +#define swFree free +#endif + //#define DEBUG "GD " // ... // INFO("Stuff to show %d", var); // new-line is automatically appended @@ -303,7 +309,7 @@ // Read the color palette colorCount = 1 << BMP_Info.biBitCount; paletteSize = sizeof(RGBQUAD) * colorCount; - colorPalette = (RGBQUAD *)malloc(paletteSize); + colorPalette = (RGBQUAD *)swMalloc(paletteSize); if (colorPalette == NULL) { fclose(Image); return(not_enough_ram); @@ -314,17 +320,17 @@ int lineBufSize = ((BPP_t * PixelWidth + 7)/8); INFO("BPP_t %d, PixelWidth %d, lineBufSize %d", BPP_t, PixelWidth, lineBufSize); - lineBuffer = (uint8_t *)malloc(lineBufSize); + lineBuffer = (uint8_t *)swMalloc(lineBufSize); if (lineBuffer == NULL) { - free(colorPalette); + swFree(colorPalette); fclose(Image); return(not_enough_ram); } - pixelBuffer = (color_t *)malloc(PixelWidth * sizeof(color_t)); + pixelBuffer = (color_t *)swMalloc(PixelWidth * sizeof(color_t)); if (pixelBuffer == NULL) { - free(lineBuffer); + swFree(lineBuffer); if (colorPalette) - free(colorPalette); + swFree(colorPalette); fclose(Image); return(not_enough_ram); } @@ -374,10 +380,10 @@ } // _EndGraphicsStream(); window(restore); - free(pixelBuffer); // don't leak memory - free(lineBuffer); + swFree(pixelBuffer); // don't leak memory + swFree(lineBuffer); if (colorPalette) - free(colorPalette); + swFree(colorPalette); return (noerror); } @@ -397,7 +403,7 @@ RetCode_t GraphicsDisplay::RenderJpegFile(loc_t x, loc_t y, const char *Name_JPG) { - #define JPEG_WORK_SPACE_SIZE 3100 + #define JPEG_WORK_SPACE_SIZE 3100 // Worst case requirements for the decompression JDEC * jdec; uint16_t * work; RetCode_t r = noerror; // start optimistic @@ -405,12 +411,10 @@ if (!fh) return(file_not_found); - //INFO("RenderJpegFile(%d,%d,%s)", x,y, Name_JPG); - work = (uint16_t *)malloc(JPEG_WORK_SPACE_SIZE); - + work = (uint16_t *)swMalloc(JPEG_WORK_SPACE_SIZE); if (work) { - jdec = (JDEC *)malloc(sizeof(JDEC)); + jdec = (JDEC *)swMalloc(sizeof(JDEC)); if (jdec) { memset(work, 0, JPEG_WORK_SPACE_SIZE/sizeof(uint16_t)); memset(jdec, 0, sizeof(JDEC)); @@ -424,12 +428,12 @@ } else { r = not_supported_format; // error("jd_prepare error:%d", r); } - free(jdec); + swFree(jdec); } else { WARN("checkpoint"); r = not_enough_ram; } - free(work); + swFree(work); } else { WARN("checkpoint"); r = not_enough_ram;