]> Joshua Wise's Git repositories - netwatch.git/blame - video/generic.c
Move checksum set to data block.
[netwatch.git] / video / generic.c
CommitLineData
0a9d0188
JP
1#include <stdint.h>
2#include <fb.h>
74032dae 3#include <crc32.h>
0a9d0188
JP
4
5uint32_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;
74032dae
JW
12 unsigned char * lineaddr;
13 int i;
0a9d0188
JP
14
15 uint32_t sum = 0;
16
17 for (i = 0; i < height; i++) {
67109eef 18 lineaddr = fb->fbaddr + (i + y) * scanline + (4 * x);
0a9d0188 19
74032dae 20 sum ^= crc32(lineaddr, width * 4);
0a9d0188
JP
21 }
22
23 return sum;
24}
25
66cd7e82
JW
26void 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;
74032dae 34 fbuf += cy * (fb->curmode.xres) + x;
66cd7e82
JW
35 for (cx = x; cx < (x + width); cx++)
36 *(ibuf++) = *(fbuf++);
37 }
38}
This page took 0.025938 seconds and 4 git commands to generate.