472 |
|
// Setup partial blitter (use 64-pixel wide chunks) |
473 |
|
const int n_pixels = 64; |
474 |
|
const int n_chunks = VIDEO_MODE_X / n_pixels; |
475 |
+ |
const int n_pixels_left = VIDEO_MODE_X - (n_chunks * n_pixels); |
476 |
|
const int src_chunk_size = src_bytes_per_row / n_chunks; |
477 |
|
const int dst_chunk_size = dst_bytes_per_row / n_chunks; |
478 |
|
const int src_chunk_size_left = src_bytes_per_row - (n_chunks * src_chunk_size); |
504 |
|
// Update the_host_buffer and copy of the_buffer, one line at a time |
505 |
|
int i1 = y1 * src_bytes_per_row; |
506 |
|
int i2 = y1 * scr_bytes_per_row; |
507 |
+ |
#ifdef USE_SDL_VIDEO |
508 |
+ |
int bbi = 0; |
509 |
+ |
SDL_Rect bb[3] = { |
510 |
+ |
{ VIDEO_MODE_X, y1, 0, 0 }, |
511 |
+ |
{ VIDEO_MODE_X, -1, 0, 0 }, |
512 |
+ |
{ VIDEO_MODE_X, -1, 0, 0 } |
513 |
+ |
}; |
514 |
+ |
#endif |
515 |
|
VIDEO_DRV_LOCK_PIXELS; |
516 |
|
for (int j = y1; j <= y2; j++) { |
517 |
|
for (int i = 0; i < n_chunks; i++) { |
519 |
|
memcpy(the_buffer_copy + i1, the_buffer + i1, src_chunk_size); |
520 |
|
Screen_blit(the_host_buffer + i2, the_buffer + i1, src_chunk_size); |
521 |
|
#ifdef USE_SDL_VIDEO |
522 |
< |
SDL_UpdateRect(drv->s, i * n_pixels, j, n_pixels, 1); |
522 |
> |
const int x = i * n_pixels; |
523 |
> |
if (x < bb[bbi].x) { |
524 |
> |
if (bb[bbi].w) |
525 |
> |
bb[bbi].w += bb[bbi].x - x; |
526 |
> |
else |
527 |
> |
bb[bbi].w = n_pixels; |
528 |
> |
bb[bbi].x = x; |
529 |
> |
} |
530 |
> |
else if (x >= bb[bbi].x + bb[bbi].w) |
531 |
> |
bb[bbi].w = x + n_pixels - bb[bbi].x; |
532 |
|
#endif |
533 |
|
} |
534 |
|
i1 += src_chunk_size; |
541 |
|
} |
542 |
|
i1 += src_chunk_size_left; |
543 |
|
i2 += dst_chunk_size_left; |
544 |
+ |
#ifdef USE_SDL_VIDEO |
545 |
+ |
const int x = n_chunks * n_pixels; |
546 |
+ |
if (x < bb[bbi].x) { |
547 |
+ |
if (bb[bbi].w) |
548 |
+ |
bb[bbi].w += bb[bbi].x - x; |
549 |
+ |
else |
550 |
+ |
bb[bbi].w = n_pixels_left; |
551 |
+ |
bb[bbi].x = x; |
552 |
+ |
} |
553 |
+ |
else if (x >= bb[bbi].x + bb[bbi].w) |
554 |
+ |
bb[bbi].w = x + n_pixels_left - bb[bbi].x; |
555 |
+ |
#endif |
556 |
|
} |
557 |
|
i2 += scr_bytes_left; |
558 |
+ |
#ifdef USE_SDL_VIDEO |
559 |
+ |
bb[bbi].h++; |
560 |
+ |
if (bb[bbi].w && (j == y1 || j == y2 - 1 || j == y2)) { |
561 |
+ |
bbi++; |
562 |
+ |
assert(bbi <= 3); |
563 |
+ |
if (j != y2) |
564 |
+ |
bb[bbi].y = j + 1; |
565 |
+ |
} |
566 |
+ |
#endif |
567 |
|
} |
568 |
+ |
#ifdef USE_SDL_VIDEO |
569 |
+ |
SDL_UpdateRects(drv->s, bbi, bb); |
570 |
+ |
#endif |
571 |
|
VIDEO_DRV_UNLOCK_PIXELS; |
572 |
|
} |
573 |
|
mainBuffer.dirty = false; |