| 81 | |
| 82 | |
| 83 | static void pixelConvert(unsigned char *srcBuf, int width, int srcPitch, |
| 84 | int height, PF *srcpf, unsigned char *dstBuf, int dstPitch, PF *dstpf, |
| 85 | int flip) |
| 86 | { |
| 87 | if(flip) |
| 88 | { |
| 89 | srcBuf = &srcBuf[srcPitch * (height - 1)]; |
| 90 | srcPitch = -srcPitch; |
| 91 | } |
| 92 | srcpf->convert(srcBuf, width, srcPitch, height, dstBuf, dstPitch, dstpf); |
| 93 | while(height--) |
| 94 | { |
| 95 | if(width * dstpf->size != dstPitch) |
| 96 | memset(&dstBuf[width * dstpf->size], 0, dstPitch - width * dstpf->size); |
| 97 | dstBuf += dstPitch; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | |
| 102 | static int ppm_load(int *fd, unsigned char **buf, int *width, int align, |