X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=video.c;fp=video.c;h=59f3e69dcd98dc1c7c3eb91d1b52ac23251ddfd7;hb=43c24b301dc8c0c5952e1d22bad865f4304d01f8;hp=d3dd3991edbded9a0bb65b0c0f4d12e68e70ab21;hpb=2455b6a30e7d58cddfa7f196c4553e008996d46a;p=gpsp.git diff --git a/video.c b/video.c index d3dd399..59f3e69 100644 --- a/video.c +++ b/video.c @@ -3903,17 +3903,18 @@ void blit_to_screen(u16 *src, u32 w, u32 h, u32 dest_x, u32 dest_y) u32 pitch = get_screen_pitch(); u16 *dest_ptr = get_screen_pixels() + dest_x + (dest_y * pitch); + s32 w1 = dest_x + w > pitch ? pitch - dest_x : w; u16 *src_ptr = src; - u32 line_skip = pitch - w; - u32 x, y; + s32 x, y; for(y = 0; y < h; y++) { - for(x = 0; x < w; x++, src_ptr++, dest_ptr++) + for(x = 0; x < w1; x++) { - *dest_ptr = *src_ptr; + dest_ptr[x] = src_ptr[x]; } - dest_ptr += line_skip; + src_ptr += w; + dest_ptr += pitch; } }