| 282 | |
| 283 | |
| 284 | int cmpBuf(int x, int y, int width, int height, PF *pf, unsigned char *buf, |
| 285 | int bassackwards) |
| 286 | { |
| 287 | int i, j, l, maxRGB = (1 << pf->bpc); |
| 288 | for(j = 0; j < height; j++) |
| 289 | { |
| 290 | l = bassackwards ? height - j - 1 : j; |
| 291 | for(i = 0; i < width; i++) |
| 292 | { |
| 293 | if(pf->id == PF_COMP) |
| 294 | { |
| 295 | if(buf[l * PAD(width * pf->size) + i] != ((j + y) * (i + x)) % maxRGB) |
| 296 | return 0; |
| 297 | } |
| 298 | else |
| 299 | { |
| 300 | int r, g, b; |
| 301 | pf->getRGB(&buf[l * PAD(width * pf->size) + i * pf->size], &r, &g, &b); |
| 302 | if(r != ((j + y) * (i + x)) % maxRGB |
| 303 | || g != ((j + y) * (i + x) * 2) % maxRGB |
| 304 | || b != ((j + y) * (i + x) * 3) % maxRGB) |
| 305 | return 0; |
| 306 | } |
| 307 | } |
| 308 | } |
| 309 | return 1; |
| 310 | } |
| 311 | |
| 312 | |
| 313 | // Makes sure the frame buffer has been cleared prior to a write |