Index: art/blit.h =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/back/Source/art/blit.h,v retrieving revision 1.10 diff -u -r1.10 blit.h --- art/blit.h 30 Jul 2004 13:57:27 -0000 1.10 +++ art/blit.h 28 Mar 2005 16:47:16 -0000 @@ -48,17 +48,20 @@ #define DI_FALLBACK 0 /* counting from lsb */ -#define DI_16_B5_G5_R5_A1 1 -#define DI_16_B5_G6_R5 2 +#define DI_8_R3_G3_B2 1 -#define DI_24_RGB 3 -#define DI_24_BGR 4 -#define DI_32_RGBA 5 -#define DI_32_BGRA 6 -#define DI_32_ARGB 7 -#define DI_32_ABGR 8 +#define DI_16_B5_G5_R5_A1 2 +#define DI_16_B5_G6_R5 3 +#define DI_16_R6_G5_B5 4 + +#define DI_24_RGB 5 +#define DI_24_BGR 6 +#define DI_32_RGBA 7 +#define DI_32_BGRA 8 +#define DI_32_ARGB 9 +#define DI_32_ABGR 10 -#define DI_NUM 9 +#define DI_NUM 11 int bytes_per_pixel; int drawing_depth; Index: art/blit.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/back/Source/art/blit.m,v retrieving revision 1.20 diff -u -r1.20 blit.m --- art/blit.m 21 Mar 2005 23:11:48 -0000 1.20 +++ art/blit.m 28 Mar 2005 16:47:16 -0000 @@ -1781,6 +1781,80 @@ #include "blit.m" #undef FORMAT_INSTANCE + +/* 16-bit 6 bits red, 5 bits green, 5 bits blue */ +#define FORMAT_INSTANCE r6g5b5 +#define FORMAT_HOW DI_16_R6_G5_B5 + +#define BLEND_TYPE unsigned short +#define BLEND_READ(p,nr,ng,nb) \ + { \ + unsigned short _s=p[0]; \ + nr=(_s&0x3f)<<2; \ + ng=(_s&0x7c0)>>3; \ + nb=(_s&0xf800)>>8; \ + } +#define BLEND_READ_ALPHA(p,pa,nr,ng,nb,na) \ + { \ + unsigned short _s=p[0]; \ + nr=(_s&0x3f)<<2; \ + ng=(_s&0x7c0)>>3; \ + nb=(_s&0xf800)>>8; \ + na=pa[0]; \ + } +#define BLEND_WRITE(p,nr,ng,nb) p[0]=(nr>>2)+((ng<<3)&0x7c0)+((nb<<8)&0xf800); +#define BLEND_WRITE_ALPHA(p,pa,nr,ng,nb,na) p[0]=(nr>>2)+((ng<<3)&0x7c0)+((nb<<8)&0xf800); pa[0]=na; +#define BLEND_INC(p) p++; + +#define ALPHA_READ(s,sa,d) d=sa[0]; +#define ALPHA_INC(s,sa) s++; sa++; + +#define COPY_TYPE unsigned short +#define COPY_TYPE_PIXEL(a) unsigned short a; +#define COPY_ASSEMBLE_PIXEL(v,r,g,b) v=(r>>2)|((g<<3)&0x7c0)|((b<<8)&0xf800); +#define COPY_WRITE(dst,v) dst[0]=v; +#define COPY_INC(dst) dst++; + +#include "blit.m" +#undef FORMAT_INSTANCE + + +/* 8-bit 3 bits red, 3 bits green, 3 bits blue */ +#define FORMAT_INSTANCE r3g3b2 +#define FORMAT_HOW DI_8_R3_G3_R2 + +#define BLEND_TYPE unsigned char +#define BLEND_READ(p,nr,ng,nb) \ + { \ + unsigned char _s=p[0]; \ + nr=(_s&0x07)<<5; \ + ng=(_s&0x38)<<3; \ + nb=(_s)&0xff; \ + } +#define BLEND_READ_ALPHA(p,pa,nr,ng,nb,na) \ + { \ + unsigned char _s=p[0]; \ + nr=(_s&0x07)<<5; \ + ng=(_s&0x38)<<3; \ + nb=(_s)&0xff; \ + na=pa[0]; \ + } +#define BLEND_WRITE(p,nr,ng,nb) p[0]=(nr>>5)+((ng>>2)&0x38)+(nb&0xc0); +#define BLEND_WRITE_ALPHA(p,pa,nr,ng,nb,na) p[0]=(nr>>5)+((ng>>2)&0x38)+(nb&0xc0); pa[0]=na; +#define BLEND_INC(p) p++; + +#define ALPHA_READ(s,sa,d) d=sa[0]; +#define ALPHA_INC(s,sa) s++; sa++; + +#define COPY_TYPE unsigned char +#define COPY_TYPE_PIXEL(a) unsigned char a; +#define COPY_ASSEMBLE_PIXEL(v,r,g,b) v=(r>>5)|((g>>2)&0x38)|(b&0xc0); +#define COPY_WRITE(dst,v) dst[0]=v; +#define COPY_INC(dst) dst++; + +#include "blit.m" +#undef FORMAT_INSTANCE + /* end of pixel formats */ @@ -1832,8 +1906,12 @@ /* TODO: try to implement fallback versions? possible? */ {DI_FALLBACK ,0, 0,0,-1,/*C(fallback)*/}, +{DI_8_R3_G3_B2 ,1, 8,0,-1,C(r3g3b2)}, + {DI_16_B5_G5_R5_A1 ,2,15,0,-1,C(b5g5r5a1)}, {DI_16_B5_G6_R5 ,2,16,0,-1,C(b5g6r5)}, +{DI_16_R6_G5_B5 ,2,16,0,-1,C(r6g5b5)}, + {DI_24_RGB ,3,24,0,-1,C(rgb)}, {DI_24_BGR ,3,24,0,-1,C(bgr)}, /* ARTContext.m assumes that only 32-bit modes have inline alpha. this @@ -1879,11 +1957,21 @@ NSDebugLLog(@"back-art", @"%s masks=(%08x %08x %08x) bpp=%i", __PRETTY_FUNCTION__, red_mask, green_mask, blue_mask, bpp); - if (bpp == 16 && red_mask == 0xf800 && green_mask == 0x7e0 && + if (bpp == 8 && red_mask == 0x07 && green_mask == 0x38 && + blue_mask == 0xc0) + { + t = DI_8_R3_G3_B2; + } + else if (bpp == 16 && red_mask == 0xf800 && green_mask == 0x7e0 && blue_mask == 0x1f) { t = DI_16_B5_G6_R5; } + else if (bpp == 16 && red_mask == 0x003f && green_mask == 0x7c0 && + blue_mask == 0xf800) + { + t = DI_16_R6_G5_B5; + } else if (bpp == 16 && red_mask == 0x7c00 && green_mask == 0x3e0 && blue_mask == 0x1f) {