]>
Commit | Line | Data |
---|---|---|
0a9d0188 JP |
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 |