diff -r 5b1e0b384d31 -r 86f099bda525 lib/unigraphic/GraphicsDisplay.cpp --- a/lib/unigraphic/GraphicsDisplay.cpp Sun Aug 30 22:53:15 2020 +0200 +++ b/lib/unigraphic/GraphicsDisplay.cpp Thu Oct 15 01:11:03 2020 +0200 @@ -19,10 +19,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - + - #include "GraphicsDisplay.h" + #define SWAP(a, b) { a ^= b; b ^= a; a ^= b; } GraphicsDisplay::GraphicsDisplay(const char *name):TextDisplay(name) { set_font((unsigned char*)Terminal6x8,32,127,true); @@ -36,7 +36,7 @@ fontzoomhor=1; auto_up = true; } - + void GraphicsDisplay::WindowMax (void) { window (0, 0, oriented_width, oriented_height); @@ -210,7 +210,7 @@ { if(x0 > x1) SWAP(x0,x1); if(y0 > y1) SWAP(y0,y1); - + int h = y1 - y0 + 1; int w = x1 - x0 + 1; unsigned int pixels = h * w; @@ -326,7 +326,7 @@ if(x<0) x=0; if(y<0) y=0; int cropX = (x+bm.xSize)-oriented_width; - if(cropX<0) cropX=0; + if(cropX<0) cropX=0; window(x, y, bm.xSize-cropX, bm.ySize); for(v=0; v < bm.ySize; v++) { // lines if((v + y) >= oriented_height) break; // no need to crop Y @@ -347,7 +347,7 @@ { int j; unsigned char padd; - unsigned short *bitmap_ptr = (unsigned short *)bitmap; + unsigned short *bitmap_ptr = (unsigned short *)bitmap; padd = w%2; // the lines are padded to multiple of 4 bytes in a bitmap if(x<0) x=0; @@ -391,8 +391,8 @@ while (*Name_BMP!='\0') { filename[i++]=*Name_BMP++; } - filename[i] = 0; - + filename[i] = 0; + FILE *Image = fopen((const char *)&filename[0], "rb"); // open the bmp file if (!Image) { return(0); // error file not found ! @@ -436,12 +436,12 @@ for (j = PixelHeigh - 1; j >= 0; j--) { //Lines bottom up off = j * (PixelWidth * 2 + padd) + start_data; // start of line fseek(Image, off ,SEEK_SET); - fread(line,1,PixelWidth * 2,Image); // read a line - slow + fread(line,1,PixelWidth * 2,Image); // read a line - slow /* for (i = 0; i < PixelWidth; i++) { // copy pixel data to TFT - // wr_16(line[i]); // one 16 bit pixel + // wr_16(line[i]); // one 16 bit pixel window_pushpixel(line[i]); - + } */ window_pushpixelbuf(line, PixelWidth); } @@ -469,5 +469,3 @@ { return (auto_up); } - -