diff --git a/src/sys/graphics/main.cpp b/src/sys/graphics/main.cpp index 4608d35..4a5119d 100755 --- a/src/sys/graphics/main.cpp +++ b/src/sys/graphics/main.cpp @@ -24,18 +24,16 @@ buf = new TGfx0(); buf2 = new TGfx0(); font = new TDPFont(); - buf->create(400,400,def_pixfmt_32bpp); + buf->create(400,400,def_pixfmt_8bpp); + buf->setRGBPalette(1,255,255,255); // buf2->create(400,400,def_pixfmt_15bpp); -// buf2->alias(*buf,0,3,8,8); - buf2->clone(*buf); - buf2->putPixel(0,0,1); - buf2->putPixel(buf2->getMaxX(),buf2->getMaxY(),1); - buf2->clear(1); - result = font->load("PACMAN.DPF"); + buf2->alias(*buf,0,0,39,7); +// buf2->clone(*buf); + result = font->load("OLDENG.DPF"); font->setColor(255,255,255); - font->putText(*buf,0,0," World"); - // buf->copyBuf(0,0,*buf,40,0,79,8); - buf->rectangle(0,0,15,7,1); + font->putText(*buf,0,0,"HelloWorld"); +// buf->copyBuf(0,0,*buf,40,0,79,8); + buf2->hFlip(); for (r=0; r<8; r++) { for (g=0; g<80; g++) if (buf->getPixel(g,r)) printf("*"); else printf(" "); diff --git a/src/sys/graphics/objgfx30.cpp b/src/sys/graphics/objgfx30.cpp index 80c0e92..c1a7787 100755 --- a/src/sys/graphics/objgfx30.cpp +++ b/src/sys/graphics/objgfx30.cpp @@ -589,7 +589,7 @@ UInt32 result; result = 42; if ((Buffer==NULL) || (LineOfs==NULL)) return TransparentColor; - if ((x<0) || (x>(Int32)MaxX) || (y<0) || y>(Int32)MaxY) + if (((UInt32)x>MaxX) || ((UInt32)y>MaxY)) return TransparentColor; switch (BPP) { case 8: @@ -669,7 +669,21 @@ void TGfx0::hFlip(void) { - + void * tmpBuf; + UInt32 xWidth, count; + if ((Buffer==NULL) || (LineOfs==NULL)) return; + xWidth = (MaxX+1)*((BPP+7) >> 3); + tmpBuf = malloc(xWidth); + if (tmpBuf == NULL) return; + for (count=0; count<=(MaxY/2); count++) { + memcpy(tmpBuf,((char*)Buffer+LineOfs[count]),xWidth); + memcpy(((char*)Buffer+LineOfs[count]), + ((char*)Buffer+LineOfs[MaxY-count]), + xWidth); + memcpy(((char*)Buffer+LineOfs[MaxY-count]),tmpBuf,xWidth); + } // for + free(tmpBuf); + return; } // TGfx0::hFlip void @@ -799,7 +813,7 @@ void TGfx0::putPixel(UInt32 x, UInt32 y, UInt32 colour) { if ((Buffer==NULL) || (LineOfs==NULL)) return; - if ((x<0) || (x>MaxX) || (y<0) || y>MaxY) return; + if (((UInt32)x>MaxX) || ((UInt32)y>MaxY)) return; switch (BPP) { case 8: asm(