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