]> Joshua Wise's Git repositories - netwatch.git/blob - video/checksumrect.c
f96c033ca95ceb9d27cf39d6c87ad37d37a3c20f
[netwatch.git] / video / checksumrect.c
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
This page took 0.020846 seconds and 2 git commands to generate.