1458 |
|
x1 = i << 3; |
1459 |
|
break; |
1460 |
|
} |
1461 |
< |
p++; |
1462 |
< |
p2++; |
1461 |
> |
p++; p2++; |
1462 |
|
} |
1463 |
|
} |
1464 |
|
x2 = x1; |
1468 |
|
p += bytes_per_row; |
1469 |
|
p2 += bytes_per_row; |
1470 |
|
for (i=(VideoMonitor.x>>3); i>(x2>>3); i--) { |
1471 |
< |
p--; |
1473 |
< |
p2--; |
1471 |
> |
p--; p2--; |
1472 |
|
if (*p != *p2) { |
1473 |
|
x2 = i << 3; |
1474 |
|
break; |
1490 |
|
for (j=y1; j<=y2; j++) { |
1491 |
|
p = &the_buffer[j * bytes_per_row]; |
1492 |
|
p2 = &the_buffer_copy[j * bytes_per_row]; |
1493 |
< |
for (i=0; i<x1; i++) { |
1494 |
< |
if (memcmp(p, p2, bytes_per_pixel)) { |
1495 |
< |
x1 = i; |
1493 |
> |
for (i=0; i<x1*bytes_per_pixel; i++) { |
1494 |
> |
if (*p != *p2) { |
1495 |
> |
x1 = i / bytes_per_pixel; |
1496 |
|
break; |
1497 |
|
} |
1498 |
< |
p += bytes_per_pixel; |
1501 |
< |
p2 += bytes_per_pixel; |
1498 |
> |
p++; p2++; |
1499 |
|
} |
1500 |
|
} |
1501 |
|
x2 = x1; |
1504 |
|
p2 = &the_buffer_copy[j * bytes_per_row]; |
1505 |
|
p += bytes_per_row; |
1506 |
|
p2 += bytes_per_row; |
1507 |
< |
for (i=VideoMonitor.x; i>x2; i--) { |
1508 |
< |
p -= bytes_per_pixel; |
1509 |
< |
p2 -= bytes_per_pixel; |
1510 |
< |
if (memcmp(p, p2, bytes_per_pixel)) { |
1511 |
< |
x2 = i; |
1507 |
> |
for (i=VideoMonitor.x*bytes_per_pixel; i>x2*bytes_per_pixel; i--) { |
1508 |
> |
p--; |
1509 |
> |
p2--; |
1510 |
> |
if (*p != *p2) { |
1511 |
> |
x2 = i / bytes_per_pixel; |
1512 |
|
break; |
1513 |
|
} |
1514 |
|
} |
1598 |
|
#ifdef HAVE_PTHREADS |
1599 |
|
static void *redraw_func(void *arg) |
1600 |
|
{ |
1601 |
+ |
uint64 start = GetTicks_usec(); |
1602 |
+ |
int64 ticks = 0; |
1603 |
+ |
uint64 next = GetTicks_usec(); |
1604 |
|
while (!redraw_thread_cancel) { |
1605 |
– |
#ifdef HAVE_NANOSLEEP |
1606 |
– |
struct timespec req = {0, 16666667}; |
1607 |
– |
nanosleep(&req, NULL); |
1608 |
– |
#else |
1609 |
– |
usleep(16667); |
1610 |
– |
#endif |
1605 |
|
VideoRefresh(); |
1606 |
+ |
next += 16667; |
1607 |
+ |
int64 delay = next - GetTicks_usec(); |
1608 |
+ |
if (delay > 0) |
1609 |
+ |
Delay_usec(delay); |
1610 |
+ |
else if (delay < -16667) |
1611 |
+ |
next = GetTicks_usec(); |
1612 |
+ |
ticks++; |
1613 |
|
} |
1614 |
+ |
uint64 end = GetTicks_usec(); |
1615 |
+ |
printf("%Ld ticks in %Ld usec = %Ld ticks/sec\n", ticks, end - start, (end - start) / ticks); |
1616 |
|
return NULL; |
1617 |
|
} |
1618 |
|
#endif |