]> Joshua Wise's Git repositories - netwatch.git/blobdiff - video/generic.c
Modify crc32 users to behave better when crcing multiple things into one CRC.
[netwatch.git] / video / generic.c
index d8b320bfe9af4231061e755c29efe60efa066ba1..95f564f470b3d9893dcefd27f1c2cf0c75c18eb0 100644 (file)
@@ -15,9 +15,9 @@ uint32_t checksum_rect_generic32(int x, int y, int width, int height) {
         uint32_t sum = 0;
 
         for (i = 0; i < height; i++) {
-                lineaddr = fb->fbaddr + (i + y) * scanline;
+                lineaddr = fb->fbaddr + (i + y) * scanline + (4 * x);
 
-                sum ^= crc32(lineaddr, width * 4);
+                sum = crc32(lineaddr, width * 4, sum);
         }
 
         return sum;
@@ -28,11 +28,11 @@ void copy_pixels_generic32(char *buf, int x, int y, int width, int height)
        int cx, cy;
        unsigned int *ibuf = (unsigned int *)buf;
        unsigned int *fbuf;
-       for (cy = y; cy < (y + height); cy++)
+       for (cy = 0; cy < height; cy++)
        {
                fbuf = (unsigned int *)fb->fbaddr;
-               fbuf += cy * (fb->curmode.xres) + x;
-               for (cx = x; cx < (x + width); cx++)
+               fbuf += (cy + y) * (fb->curmode.xres) + x;
+               for (cx = 0; cx < width; cx++)
                        *(ibuf++) = *(fbuf++);
        }
 }
This page took 0.024116 seconds and 4 git commands to generate.