| 34 | |
| 35 | |
| 36 | static void initBuf(unsigned char *buf, int width, int pitch, int height, |
| 37 | PF *srcpf, PF *dstpf) |
| 38 | { |
| 39 | int i, j, maxRGB = min(1 << srcpf->bpc, 1 << dstpf->bpc); |
| 40 | |
| 41 | for(j = 0; j < height; j++) |
| 42 | { |
| 43 | for(i = 0; i < width; i++) |
| 44 | { |
| 45 | int r, g, b; |
| 46 | memset(&buf[j * pitch + i * srcpf->size], 0, srcpf->size); |
| 47 | r = (i * maxRGB / width) % maxRGB; g = (j * maxRGB / height) % maxRGB; |
| 48 | b = (j * maxRGB / height + i * maxRGB / width) % maxRGB; |
| 49 | if(srcpf->bpc == 10 && dstpf->bpc == 8) |
| 50 | { |
| 51 | r <<= 2; g <<= 2; b <<= 2; |
| 52 | } |
| 53 | srcpf->setRGB(&buf[j * pitch + i * srcpf->size], r, g, b); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | |
| 59 | static int cmpBuf(unsigned char *buf, int width, int pitch, int height, |