diff --git a/src/sys/graphics/main.cpp b/src/sys/graphics/main.cpp index 00c458a..564622a 100755 --- a/src/sys/graphics/main.cpp +++ b/src/sys/graphics/main.cpp @@ -10,11 +10,17 @@ int main() { TPixelFmt pixfmt; + UInt32 foo; TGfx0* buf=0; + TGfx0* buf2=0; buf = new TGfx0(); + buf2 = new TGfx0(); pixfmt.BPP=8; - buf->create(400,400,(TPixelFmt *)&def_pixfmt_16bpp); - printf("BPP: %d\n", buf->BPP); + buf->create(400,400,(TPixelFmt *)&def_pixfmt_8bpp); + buf2->create(400,400,(TPixelFmt *)&def_pixfmt_8bpp); + buf->flip(buf2); + foo=buf->RGB(0,0,0); + printf("%d\n",(int)foo); if (buf) delete buf; return(0); } diff --git a/src/sys/graphics/objgfx30.cpp b/src/sys/graphics/objgfx30.cpp index d11ce41..8798eb1 100755 --- a/src/sys/graphics/objgfx30.cpp +++ b/src/sys/graphics/objgfx30.cpp @@ -82,14 +82,16 @@ for (yy=0; yy<=yCount; yy++) for (xx=0; xx<=xCount; xx++) { SrcObject->unpackRGB(SrcObject->getpixel(xx,yy),&r,&g,&b); - // putpixel(xx,yy,RGB(r,g,b); + putpixel(xx,yy,RGB(r,g,b)); } // for } // if else { xCount=xCount*((BPP+7) >> 3); // adjust for bpp for (count=0; count<=yCount; count++) ; - // memcpy( + memcpy(((char*)Buffer+LineOfs[count]), // dest + ((char*)SrcObject->Buffer+SrcObject->LineOfs[count]), // src + xCount); // len } // else } // TGfx0::flip @@ -110,7 +112,29 @@ } // TGfx0::putpixel UInt32 TGfx0::RGB(UInt8 red, UInt8 green, UInt8 blue) { - return 0; + UInt32 lastclr; + lastclr=0; + switch (BPP) { + case 8: + asm( + "movl $256,%%ecx \n" + "movl $256*3+1, %%ebx \n" + "xorl %%eax, %%eax \n" + "lop: \n" + "pushl %%eax \n" + "movb (%%esi), %%al \n" + "incl %%esi \n" + "subb %0, %%al \n" + "popl %%eax \n" + "decl %%ecx \n" + "jcxz lop \n" + : + :"S"(pal), "a"(red) + :"eax","ecx" + ); // asm + break; + } // switch + return lastclr; } // TGfx0::RGB void TGfx0::unpackRGB(UInt32 colour, UInt8* red, UInt8* green, UInt8* blue) {