]>
Commit | Line | Data |
---|---|---|
1 | #include <stdint.h> | |
2 | #include <fb.h> | |
3 | #include <crc32.h> | |
4 | ||
5 | uint32_t checksum_rect_generic32(int x, int y, int width, int height) { | |
6 | ||
7 | /* Generic checksum_rect function for video modes with 32-bit pixels | |
8 | * (i.e. fb->curmode.bytestride = 4). | |
9 | */ | |
10 | ||
11 | int scanline = fb->curmode.xres * 4; | |
12 | unsigned char * lineaddr; | |
13 | int i; | |
14 | ||
15 | uint32_t sum = 0; | |
16 | ||
17 | for (i = 0; i < height; i++) { | |
18 | lineaddr = fb->fbaddr + (i + y) * scanline; | |
19 | ||
20 | sum ^= crc32(lineaddr, width * 4); | |
21 | } | |
22 | ||
23 | return sum; | |
24 | } | |
25 | ||
26 | void copy_pixels_generic32(char *buf, int x, int y, int width, int height) | |
27 | { | |
28 | int cx, cy; | |
29 | unsigned int *ibuf = (unsigned int *)buf; | |
30 | unsigned int *fbuf; | |
31 | for (cy = y; cy < (y + height); cy++) | |
32 | { | |
33 | fbuf = (unsigned int *)fb->fbaddr; | |
34 | fbuf += cy * (fb->curmode.xres) + x; | |
35 | for (cx = x; cx < (x + width); cx++) | |
36 | *(ibuf++) = *(fbuf++); | |
37 | } | |
38 | } |