]> Joshua Wise's Git repositories - netwatch.git/blame - video/generic.c
Avoid suffering from wrong CS_SEGSEL syndrome.
[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
f2da68c5 20 sum = crc32(lineaddr, width * 4, sum);
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;
ec5f9ca5 31 for (cy = 0; cy < height; cy++)
66cd7e82
JW
32 {
33 fbuf = (unsigned int *)fb->fbaddr;
ec5f9ca5
JP
34 fbuf += (cy + y) * (fb->curmode.xres) + x;
35 for (cx = 0; cx < width; cx++)
66cd7e82
JW
36 *(ibuf++) = *(fbuf++);
37 }
38}
This page took 0.02736 seconds and 4 git commands to generate.