diff --git a/src/include/86box/vid_svga.h b/src/include/86box/vid_svga.h index 93d4aeffc..91559aa72 100644 --- a/src/include/86box/vid_svga.h +++ b/src/include/86box/vid_svga.h @@ -202,7 +202,7 @@ void svga_close(svga_t *svga); uint32_t svga_mask_addr(uint32_t addr, svga_t *svga); uint32_t svga_mask_changedaddr(uint32_t addr, svga_t *svga); -void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga); +void svga_doblit(int wx, int wy, svga_t *svga); enum { diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 479312d1a..83c57e444 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -150,10 +150,10 @@ extern void video_inform(int type, const video_timings_t *ptr); extern int video_get_type(void); -extern void video_setblit(void(*blit)(int,int,int,int,int,int)); +extern void video_setblit(void(*blit)(int,int,int,int)); extern void video_blend(int x, int y); -extern void video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h); -extern void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h); +extern void video_blit_memtoscreen_8(int x, int y, int w, int h); +extern void video_blit_memtoscreen(int x, int y, int w, int h); extern void video_blit_complete(void); extern void video_wait_for_blit(void); extern void video_wait_for_buffer(void); diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 24fc1be51..10e4df12e 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -577,10 +577,10 @@ vid_poll_1512(void *priv) } if (enable_overscan) { - video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, 0, ((vid->lastline - vid->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, xsize, ((vid->lastline - vid->firstline) + 8) << 1); } else { - video_blit_memtoscreen_8(8, vid->firstline << 1, 0, (vid->lastline - vid->firstline) << 1, + video_blit_memtoscreen_8(8, vid->firstline << 1, xsize, (vid->lastline - vid->firstline) << 1); } } @@ -1403,7 +1403,7 @@ lcdm_poll(amsvid_t *vid) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, mda->firstline, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, mda->firstline, xsize, ysize); frames++; video_res_x = mda->crtc[1]; video_res_y = mda->crtc[6]; @@ -1571,7 +1571,7 @@ lcdc_poll(amsvid_t *vid) video_force_resize_set(0); } - video_blit_memtoscreen(0, cga->firstline << 1, 0, (cga->lastline - cga->firstline) << 1, + video_blit_memtoscreen(0, cga->firstline << 1, xsize, (cga->lastline - cga->firstline) << 1); } diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index e0aef82ef..4772c3ccc 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -514,7 +514,7 @@ compaq_plasma_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x400 resolution */ diff --git a/src/machine/m_at_t3100e_vid.c b/src/machine/m_at_t3100e_vid.c index cf012a27b..b52c8ef03 100644 --- a/src/machine/m_at_t3100e_vid.c +++ b/src/machine/m_at_t3100e_vid.c @@ -590,7 +590,7 @@ void t3100e_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x400 resolution */ diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index c51dbf03a..c54c7f0c7 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -566,17 +566,17 @@ vid_poll(void *p) if (enable_overscan) { if (pcjr->composite) - video_blit_memtoscreen(0, (pcjr->firstline - 4) << 1, 0, ((pcjr->lastline - pcjr->firstline) + 8) << 1, + video_blit_memtoscreen(0, (pcjr->firstline - 4) << 1, xsize, ((pcjr->lastline - pcjr->firstline) + 8) << 1); else - video_blit_memtoscreen_8(0, (pcjr->firstline - 4) << 1, 0, ((pcjr->lastline - pcjr->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (pcjr->firstline - 4) << 1, xsize, ((pcjr->lastline - pcjr->firstline) + 8) << 1); } else { if (pcjr->composite) - video_blit_memtoscreen(8, pcjr->firstline << 1, 0, (pcjr->lastline - pcjr->firstline) << 1, + video_blit_memtoscreen(8, pcjr->firstline << 1, xsize, (pcjr->lastline - pcjr->firstline) << 1); else - video_blit_memtoscreen_8(8, pcjr->firstline << 1, 0, (pcjr->lastline - pcjr->firstline) << 1, + video_blit_memtoscreen_8(8, pcjr->firstline << 1, xsize, (pcjr->lastline - pcjr->firstline) << 1); } } diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 75aa7cbeb..8de9883b7 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -1032,17 +1032,17 @@ vid_poll(void *priv) if (enable_overscan) { if (!dev->is_sl2 && vid->composite) - video_blit_memtoscreen(0, (vid->firstline - 4) << 1, 0, ((vid->lastline - vid->firstline) + 8) << 1, + video_blit_memtoscreen(0, (vid->firstline - 4) << 1, xsize, ((vid->lastline - vid->firstline) + 8) << 1); else - video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, 0, ((vid->lastline - vid->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, xsize, ((vid->lastline - vid->firstline) + 8) << 1); } else { if (!dev->is_sl2 && vid->composite) - video_blit_memtoscreen(8, vid->firstline << 1, 0, (vid->lastline - vid->firstline) << 1, + video_blit_memtoscreen(8, vid->firstline << 1, xsize, (vid->lastline - vid->firstline) << 1); else - video_blit_memtoscreen_8(8, vid->firstline << 1, 0, (vid->lastline - vid->firstline) << 1, + video_blit_memtoscreen_8(8, vid->firstline << 1, xsize, (vid->lastline - vid->firstline) << 1); } } diff --git a/src/machine/m_xt_t1000_vid.c b/src/machine/m_xt_t1000_vid.c index c3930d29e..8e1c7029c 100644 --- a/src/machine/m_xt_t1000_vid.c +++ b/src/machine/m_xt_t1000_vid.c @@ -556,7 +556,7 @@ static void t1000_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x200 resolution */ diff --git a/src/unix/unix.c b/src/unix/unix.c index 93d3ede73..ca2866cb4 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -161,10 +161,10 @@ static const uint16_t sdl_to_xt[0x200] = typedef struct sdl_blit_params { - int x, y, y1, y2, w, h; + int x, y, w, h; } sdl_blit_params; -sdl_blit_params params = { 0, 0, 0, 0, 0, 0 }; +sdl_blit_params params = { 0, 0, 0, 0 }; int blitreq = 0; void* dynld_module(const char *name, dllimp_t *table) @@ -607,7 +607,7 @@ void ui_sb_bugui(char *str) } -extern void sdl_blit(int x, int y, int y1, int y2, int w, int h); +extern void sdl_blit(int x, int y, int w, int h); typedef struct mouseinputdata { @@ -1122,8 +1122,8 @@ int main(int argc, char** argv) } if (blitreq) { - extern void sdl_blit(int x, int y, int y1, int y2, int w, int h); - sdl_blit(params.x, params.y, params.y1, params.y2, params.w, params.h); + extern void sdl_blit(int x, int y, int w, int h); + sdl_blit(params.x, params.y, params.w, params.h); } if (title_set) { diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index ff31e5786..ae5b43a9b 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -23,7 +23,7 @@ typedef struct sdl_blit_params { - int x, y, y1, y2, w, h; + int x, y, w, h; } sdl_blit_params; extern sdl_blit_params params; extern int blitreq; @@ -121,26 +121,24 @@ sdl_stretch(int *w, int *h, int *x, int *y) void -sdl_blit_shim(int x, int y, int y1, int y2, int w, int h) +sdl_blit_shim(int x, int y, int w, int h) { params.x = x; params.y = y; params.w = w; params.h = h; - params.y1 = y1; - params.y2 = y2; blitreq = 1; } void ui_window_title_real(); void -sdl_blit(int x, int y, int y1, int y2, int w, int h) +sdl_blit(int x, int y, int w, int h) { SDL_Rect r_src; int ret; - if (!sdl_enabled || (y1 == y2) || (h <= 0) || (render_buffer == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { + if (!sdl_enabled || (h <= 0) || (render_buffer == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { video_blit_complete(); return; } @@ -153,17 +151,17 @@ sdl_blit(int x, int y, int y1, int y2, int w, int h) else sdl_resize(resize_w, resize_h); resize_pending = 0; } - r_src.x = 0; - r_src.y = y1; + r_src.x = x; + r_src.y = y; r_src.w = w; - r_src.h = y2 - y1; - SDL_UpdateTexture(sdl_tex, &r_src, &(render_buffer->dat)[y1 * w], w * 4); + r_src.h = h; + SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), (2048 + 64) * 4); video_blit_complete(); SDL_RenderClear(sdl_render); - r_src.x = 0; - r_src.y = 0; + r_src.x = x; + r_src.y = y; r_src.w = w; r_src.h = h; diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index dda14f48e..ef3f2c4ef 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -463,17 +463,17 @@ cga_poll(void *p) if (enable_overscan) { if (cga->composite) - video_blit_memtoscreen(0, (cga->firstline - 4) << 1, 0, ((cga->lastline - cga->firstline) + 8) << 1, + video_blit_memtoscreen(0, (cga->firstline - 4) << 1, xsize, ((cga->lastline - cga->firstline) + 8) << 1); else - video_blit_memtoscreen_8(0, (cga->firstline - 4) << 1, 0, ((cga->lastline - cga->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (cga->firstline - 4) << 1, xsize, ((cga->lastline - cga->firstline) + 8) << 1); } else { if (cga->composite) - video_blit_memtoscreen(8, cga->firstline << 1, 0, (cga->lastline - cga->firstline) << 1, + video_blit_memtoscreen(8, cga->firstline << 1, xsize, (cga->lastline - cga->firstline) << 1); else - video_blit_memtoscreen_8(8, cga->firstline << 1, 0, (cga->lastline - cga->firstline) << 1, + video_blit_memtoscreen_8(8, cga->firstline << 1, xsize, (cga->lastline - cga->firstline) << 1); } } diff --git a/src/video/vid_colorplus.c b/src/video/vid_colorplus.c index ed5cd6f00..3343aaf0e 100644 --- a/src/video/vid_colorplus.c +++ b/src/video/vid_colorplus.c @@ -326,9 +326,9 @@ void colorplus_poll(void *p) } if (colorplus->cga.composite) - video_blit_memtoscreen(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); + video_blit_memtoscreen(0, colorplus->cga.firstline - 4, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); else - video_blit_memtoscreen_8(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); + video_blit_memtoscreen_8(0, colorplus->cga.firstline - 4, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); frames++; video_res_x = xsize - 16; diff --git a/src/video/vid_compaq_cga.c b/src/video/vid_compaq_cga.c index 0a82bdee1..d971a6af4 100644 --- a/src/video/vid_compaq_cga.c +++ b/src/video/vid_compaq_cga.c @@ -340,14 +340,14 @@ compaq_cga_poll(void *p) if (enable_overscan) { if (self->cga.composite) - video_blit_memtoscreen(0, self->cga.firstline - 8, 0, (self->cga.lastline - self->cga.firstline) + 16, xsize, (self->cga.lastline - self->cga.firstline) + 16); + video_blit_memtoscreen(0, self->cga.firstline - 8, xsize, (self->cga.lastline - self->cga.firstline) + 16); else - video_blit_memtoscreen_8(0, self->cga.firstline - 8, 0, (self->cga.lastline - self->cga.firstline) + 16, xsize, (self->cga.lastline - self->cga.firstline) + 16); + video_blit_memtoscreen_8(0, self->cga.firstline - 8, xsize, (self->cga.lastline - self->cga.firstline) + 16); } else { if (self->cga.composite) - video_blit_memtoscreen(8, self->cga.firstline, 0, self->cga.lastline - self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); + video_blit_memtoscreen(8, self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); else - video_blit_memtoscreen_8(8, self->cga.firstline, 0, self->cga.lastline - self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); + video_blit_memtoscreen_8(8, self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); } } diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 570a676d3..c8f2a43c1 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -35,7 +35,7 @@ #include <86box/vid_ega.h> -void ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega); +void ega_doblit(int wx, int wy, ega_t *ega); #define BIOS_IBM_PATH "roms/video/ega/ibm_6277356_ega_card_u44_27128.bin" @@ -597,10 +597,10 @@ ega_poll(void *p) if (ega->vres) { wy = (ega->lastline - ega->firstline) << 1; - ega_doblit(ega->firstline_draw << 1, (ega->lastline_draw + 1) << 1, wx, wy, ega); + ega_doblit(wx, wy, ega); } else { wy = ega->lastline - ega->firstline; - ega_doblit(ega->firstline_draw, ega->lastline_draw + 1, wx, wy, ega); + ega_doblit(wx, wy, ega); } frames++; @@ -658,7 +658,7 @@ ega_poll(void *p) void -ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega) +ega_doblit(int wx, int wy, ega_t *ega) { int y_add = (enable_overscan) ? overscan_y : 0; int x_add = (enable_overscan) ? overscan_x : 0; @@ -676,12 +676,7 @@ ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega) } if ((wx <= 0) || (wy <= 0)) { - video_blit_memtoscreen(x_start, y_start, 0, 0, 0, 0); - return; - } - - if (y1 > y2) { - video_blit_memtoscreen(x_start, y_start, 0, 0, xsize + x_add, ysize + y_add); + video_blit_memtoscreen(x_start, y_start, 0, 0); return; } @@ -734,7 +729,7 @@ ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega) } } - video_blit_memtoscreen(x_start, y_start, y1, y2 + y_add, xsize + x_add, ysize + y_add); + video_blit_memtoscreen(x_start, y_start, xsize + x_add, ysize + y_add); if (ega->vres) ega->y_add >>= 1; diff --git a/src/video/vid_f82c425.c b/src/video/vid_f82c425.c index ab8b12299..a9d2f14ba 100644 --- a/src/video/vid_f82c425.c +++ b/src/video/vid_f82c425.c @@ -584,7 +584,7 @@ static void f82c425_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x200 resolution */ diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index c054230b1..57854a051 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -689,7 +689,7 @@ genius_poll(void *p) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, 0, xsize, ysize); frames++; /* Fixed 728x1008 resolution */ diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index 4e1d4e8b9..6c9660bb8 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -517,9 +517,9 @@ hercules_poll(void *priv) } if (enable_overscan) - video_blit_memtoscreen_8(0, dev->firstline, 0, ysize + 28, xsize + 16, ysize + 28); + video_blit_memtoscreen_8(0, dev->firstline, xsize + 16, ysize + 28); else - video_blit_memtoscreen_8(8, dev->firstline + 14, 0, ysize + 14, xsize, ysize); + video_blit_memtoscreen_8(8, dev->firstline + 14, xsize, ysize); frames++; // if ((dev->ctrl & 2) && (dev->ctrl2 & 1)) { if (dev->ctrl & 0x02) { diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index df5b01da0..607780a68 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -581,7 +581,7 @@ herculesplus_poll(void *priv) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, dev->firstline, 0, dev->lastline - dev->firstline, xsize, dev->lastline - dev->firstline); + video_blit_memtoscreen_8(0, dev->firstline, xsize, dev->lastline - dev->firstline); frames++; if ((dev->ctrl & HERCULESPLUS_CTRL_GRAPH) && (dev->ctrl2 & HERCULESPLUS_CTRL2_GRAPH)) { video_res_x = dev->crtc[1] * 16; diff --git a/src/video/vid_incolor.c b/src/video/vid_incolor.c index 8b644077e..64d93a5c0 100644 --- a/src/video/vid_incolor.c +++ b/src/video/vid_incolor.c @@ -998,7 +998,7 @@ incolor_poll(void *priv) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, dev->firstline, 0, dev->lastline - dev->firstline, xsize, dev->lastline - dev->firstline); + video_blit_memtoscreen(0, dev->firstline, xsize, dev->lastline - dev->firstline); frames++; if ((dev->ctrl & INCOLOR_CTRL_GRAPH) && (dev->ctrl2 & INCOLOR_CTRL2_GRAPH)) { video_res_x = dev->crtc[1] * 16; diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index c05744b01..f2550f134 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -230,7 +230,7 @@ void mda_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, mda->firstline, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, mda->firstline, xsize, ysize); frames++; video_res_x = mda->crtc[1]; video_res_y = mda->crtc[6]; diff --git a/src/video/vid_nga.c b/src/video/vid_nga.c index 66c09d744..1c34db342 100644 --- a/src/video/vid_nga.c +++ b/src/video/vid_nga.c @@ -474,17 +474,17 @@ nga_poll(void *priv) /* nga specific */ if (enable_overscan) { if (nga->cga.composite) - video_blit_memtoscreen(0, (nga->cga.firstline - 8), 0, (nga->cga.lastline - nga->cga.firstline) + 16, + video_blit_memtoscreen(0, (nga->cga.firstline - 8), xsize, (nga->cga.lastline - nga->cga.firstline) + 16); else - video_blit_memtoscreen_8(0, (nga->cga.firstline - 8), 0, (nga->cga.lastline - nga->cga.firstline) + 16, + video_blit_memtoscreen_8(0, (nga->cga.firstline - 8), xsize, (nga->cga.lastline - nga->cga.firstline) + 16); } else { if (nga->cga.composite) - video_blit_memtoscreen(8, nga->cga.firstline, 0, (nga->cga.lastline - nga->cga.firstline), + video_blit_memtoscreen(8, nga->cga.firstline, xsize, (nga->cga.lastline - nga->cga.firstline)); else - video_blit_memtoscreen_8(8, nga->cga.firstline, 0, (nga->cga.lastline - nga->cga.firstline), + video_blit_memtoscreen_8(8, nga->cga.firstline, xsize, (nga->cga.lastline - nga->cga.firstline)); } } diff --git a/src/video/vid_ogc.c b/src/video/vid_ogc.c index cdc433bdf..c562c6f11 100644 --- a/src/video/vid_ogc.c +++ b/src/video/vid_ogc.c @@ -489,17 +489,17 @@ ogc_poll(void *priv) /* ogc specific */ if (enable_overscan) { if (ogc->cga.composite) - video_blit_memtoscreen(0, (ogc->cga.firstline - 8), 0, (ogc->cga.lastline - ogc->cga.firstline) + 16, + video_blit_memtoscreen(0, (ogc->cga.firstline - 8), xsize, (ogc->cga.lastline - ogc->cga.firstline) + 16); else - video_blit_memtoscreen_8(0, (ogc->cga.firstline - 8), 0, (ogc->cga.lastline - ogc->cga.firstline) + 16, + video_blit_memtoscreen_8(0, (ogc->cga.firstline - 8), xsize, (ogc->cga.lastline - ogc->cga.firstline) + 16); } else { if (ogc->cga.composite) - video_blit_memtoscreen(8, ogc->cga.firstline, 0, (ogc->cga.lastline - ogc->cga.firstline), + video_blit_memtoscreen(8, ogc->cga.firstline, xsize, (ogc->cga.lastline - ogc->cga.firstline)); else - video_blit_memtoscreen_8(8, ogc->cga.firstline, 0, (ogc->cga.lastline - ogc->cga.firstline), + video_blit_memtoscreen_8(8, ogc->cga.firstline, xsize, (ogc->cga.lastline - ogc->cga.firstline)); } } diff --git a/src/video/vid_pgc.c b/src/video/vid_pgc.c index 213d85f6a..34e5c2d99 100644 --- a/src/video/vid_pgc.c +++ b/src/video/vid_pgc.c @@ -2493,7 +2493,7 @@ pgc_cga_poll(pgc_t *dev) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, 0, xsize, ysize); frames++; /* We have a fixed 640x400 screen for CGA modes. */ @@ -2578,7 +2578,7 @@ pgc_poll(void *priv) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; video_res_x = dev->screenw; diff --git a/src/video/vid_sigma.c b/src/video/vid_sigma.c index 88365b427..008232bc4 100644 --- a/src/video/vid_sigma.c +++ b/src/video/vid_sigma.c @@ -758,7 +758,7 @@ sigma_poll(void *p) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, sigma->firstline - 4, 0, (sigma->lastline - sigma->firstline) + 8, xsize, (sigma->lastline - sigma->firstline) + 8); + video_blit_memtoscreen_8(0, sigma->firstline - 4, xsize, (sigma->lastline - sigma->firstline) + 8); frames++; video_res_x = xsize - 16; diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 07f6f3823..9615c10a0 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -41,7 +41,7 @@ #include <86box/vid_svga_render.h> -void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga); +void svga_doblit(int wx, int wy, svga_t *svga); extern int cyc_total; extern uint8_t edatlookup[4][4]; @@ -823,10 +823,10 @@ svga_poll(void *p) if (!svga->override) { if (svga->vertical_linedbl) { wy = (svga->lastline - svga->firstline) << 1; - svga_doblit(svga->firstline_draw << 1, (svga->lastline_draw + 1) << 1, wx, wy, svga); + svga_doblit(wx, wy, svga); } else { wy = svga->lastline - svga->firstline; - svga_doblit(svga->firstline_draw, svga->lastline_draw + 1, wx, wy, svga); + svga_doblit(wx, wy, svga); } } @@ -1342,7 +1342,7 @@ svga_read_linear(uint32_t addr, void *p) void -svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) +svga_doblit(int wx, int wy, svga_t *svga) { int y_add, x_add, y_start, x_start, bottom; uint32_t *p; @@ -1362,12 +1362,7 @@ svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) } if ((wx <= 0) || (wy <= 0)) { - video_blit_memtoscreen(x_start, y_start, 0, 0, 0, 0); - return; - } - - if (y1 > y2) { - video_blit_memtoscreen(x_start, y_start, 0, 0, xsize + x_add, ysize + y_add); + video_blit_memtoscreen(x_start, y_start, 0, 0); return; } @@ -1423,7 +1418,7 @@ svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) } } - video_blit_memtoscreen(x_start, y_start, y1, y2 + y_add, xsize + x_add, ysize + y_add); + video_blit_memtoscreen(x_start, y_start, xsize + x_add, ysize + y_add); if (svga->vertical_linedbl) svga->vertical_linedbl >>= 1; diff --git a/src/video/vid_voodoo_display.c b/src/video/vid_voodoo_display.c index bfee8554c..a52249bee 100644 --- a/src/video/vid_voodoo_display.c +++ b/src/video/vid_voodoo_display.c @@ -655,7 +655,7 @@ skip_draw: thread_release_mutex(voodoo->force_blit_mutex); if (voodoo->dirty_line_high > voodoo->dirty_line_low || force_blit) - svga_doblit(0, voodoo->v_disp, voodoo->h_disp, voodoo->v_disp-1, voodoo->svga); + svga_doblit(voodoo->h_disp, voodoo->v_disp-1, voodoo->svga); if (voodoo->clutData_dirty) { voodoo->clutData_dirty = 0; diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index 0affbd58e..57faf5fdc 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -870,7 +870,7 @@ void wy700_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, 0, xsize, ysize); frames++; /* Fixed 1280x800 resolution */ diff --git a/src/video/video.c b/src/video/video.c index 66323f079..a98f125cb 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -244,7 +244,7 @@ const uint32_t shade[5][256] = static struct { - int x, y, y1, y2, w, h; + int x, y, w, h; int busy; int buffer_in_use; @@ -255,7 +255,7 @@ static struct { } blit_data; -static void (*blit_func)(int x, int y, int y1, int y2, int w, int h); +static void (*blit_func)(int x, int y, int w, int h); #ifdef ENABLE_VIDEO_LOG @@ -279,7 +279,7 @@ video_log(const char *fmt, ...) void -video_setblit(void(*blit)(int,int,int,int,int,int)) +video_setblit(void(*blit)(int,int,int,int)) { blit_func = blit; } @@ -317,7 +317,7 @@ static png_infop info_ptr; static void -video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, int w, int h) +video_take_screenshot(const char *fn) { int i, x, y; png_bytep *b_rgb = NULL; @@ -349,25 +349,26 @@ video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, in png_init_io(png_ptr, fp); - png_set_IHDR(png_ptr, info_ptr, w, h, + png_set_IHDR(png_ptr, info_ptr, blit_data.w, blit_data.h, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * h); + b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * blit_data.h); if (b_rgb == NULL) { video_log("[video_take_screenshot] Unable to Allocate RGB Bitmap Memory"); fclose(fp); return; } - for (y = 0; y < h; ++y) { + for (y = 0; y < blit_data.h; ++y) { b_rgb[y] = (png_byte *) malloc(png_get_rowbytes(png_ptr, info_ptr)); - for (x = 0; x < w; ++x) { - temp = buffer32->line[starty + y][startx + x]; - - b_rgb[y][(x) * 3 + 0] = (temp >> 16) & 0xff; - b_rgb[y][(x) * 3 + 1] = (temp >> 8) & 0xff; - b_rgb[y][(x) * 3 + 2] = temp & 0xff; + for (x = 0; x < blit_data.w; ++x) { + if (buffer32 == NULL) + memset(&(b_rgb[y][x * 3]), 0x00, 3); + else { + temp = buffer32->line[blit_data.y + y][blit_data.x + x]; + memcpy(&(b_rgb[y][x * 3]), &temp, 3); + } } } @@ -378,7 +379,7 @@ video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, in png_write_end(png_ptr, NULL); /* cleanup heap allocation */ - for (i = 0; i < h; i++) + for (i = 0; i < blit_data.h; i++) if (b_rgb[i]) free(b_rgb[i]); if (b_rgb) free(b_rgb); @@ -388,7 +389,7 @@ video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, in static void -video_screenshot(int x, int y, int y1, int y2, int w, int h) +video_screenshot(void) { char path[1024], fn[128]; @@ -407,7 +408,7 @@ video_screenshot(int x, int y, int y1, int y2, int w, int h) video_log("taking screenshot to: %s\n", path); - video_take_screenshot((const char *) path, x, y, y1, y2, w, h); + video_take_screenshot((const char *) path); png_destroy_write_struct(&png_ptr, &info_ptr); } @@ -417,10 +418,12 @@ video_transform_copy(uint32_t *dst, uint32_t *src, int len) { int i; - for (i = 0; i < len; i++) { - *dst = video_color_transform(*src); - dst++; - src++; + if ((dst != NULL) && (src != NULL)) { + for (i = 0; i < len; i++) { + *dst = video_color_transform(*src); + dst++; + src++; + } } } @@ -435,8 +438,8 @@ void blit_thread(void *param) thread_reset_event(blit_data.wake_blit_thread); MTR_BEGIN("video", "blit_thread"); - if ((video_grayscale || invert_display) && blit_data.y2 > 0) { - for (yy = blit_data.y1; yy < blit_data.y2; yy++) { + if ((video_grayscale || invert_display) && (blit_data.h > 0)) { + for (yy = 0; yy < blit_data.h; yy++) { if (((blit_data.y + yy) >= 0) && ((blit_data.y + yy) < buffer32->h)) { video_transform_copy(&(buffer32->line[blit_data.y + yy][blit_data.x]), &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w); } @@ -444,16 +447,13 @@ void blit_thread(void *param) } if (screenshots) { - if (buffer32 != NULL) - video_screenshot(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h); + video_screenshot(); screenshots--; video_log("screenshot taken, %i left\n", screenshots); } if (blit_func) - blit_func(blit_data.x, blit_data.y, - blit_data.y1, blit_data.y2, - blit_data.w, blit_data.h); + blit_func(blit_data.x, blit_data.y, blit_data.w, blit_data.h); blit_data.busy = 0; @@ -464,7 +464,7 @@ void blit_thread(void *param) void -video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) +video_blit_memtoscreen(int x, int y, int w, int h) { MTR_BEGIN("video", "video_blit_memtoscreen"); @@ -477,8 +477,6 @@ video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) blit_data.buffer_in_use = 1; blit_data.x = x; blit_data.y = y; - blit_data.y1 = y1; - blit_data.y2 = y2; blit_data.w = w; blit_data.h = h; @@ -542,7 +540,7 @@ video_blend(int x, int y) void -video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h) +video_blit_memtoscreen_8(int x, int y, int w, int h) { int yy, xx; @@ -559,7 +557,7 @@ video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h) } } - video_blit_memtoscreen(x, y, y1, y2, w, h); + video_blit_memtoscreen(x, y, w, h); } diff --git a/src/vnc.c b/src/vnc.c index 5f687a9f3..f2f4655b0 100644 --- a/src/vnc.c +++ b/src/vnc.c @@ -167,16 +167,19 @@ vnc_display(rfbClientPtr cl) static void -vnc_blit(int x, int y, int y1, int y2, int w, int h) +vnc_blit(int x, int y, int w, int h) { uint32_t *p; int yy; - for (yy=y1; yyframeBuffer)[yy*VNC_MAX_X]); if ((y+yy) >= 0 && (y+yy) < VNC_MAX_Y) - memcpy(p, &(buffer32->line[yy]), w*4); + memcpy(p, &(buffer32->line[yy]), w*sizeof(uint32_t)); } video_blit_complete(); diff --git a/src/win/win_opengl.c b/src/win/win_opengl.c index dec6436d0..7e92e40b8 100644 --- a/src/win/win_opengl.c +++ b/src/win/win_opengl.c @@ -808,11 +808,11 @@ static void opengl_main(void* param) CoUninitialize(); } -static void opengl_blit(int x, int y, int y1, int y2, int w, int h) +static void opengl_blit(int x, int y, int w, int h) { int yy; - if (y1 == y2 || h <= 0 || buffer32 == NULL || thread == NULL || + if ((h <= 0) || (buffer32 == NULL) || (thread == NULL) || atomic_flag_test_and_set(&blit_info[write_pos].in_use)) { video_blit_complete(); @@ -821,8 +821,8 @@ static void opengl_blit(int x, int y, int y1, int y2, int w, int h) for (yy = 0; yy < h; yy++) { if ((y + yy) >= 0 && (y + yy) < buffer32->h) - memcpy(blit_info[write_pos].buffer + (yy * w * 4), - &(((uint32_t *) buffer32->line[y + yy])[x]), w * 4); + memcpy(blit_info[write_pos].buffer + (yy * w * sizeof(uint32_t)), + &(((uint32_t *) buffer32->line[y + yy])[x]), w * sizeof(uint32_t)); } video_blit_complete(); diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index c5978501f..303fb5f69 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -229,12 +229,12 @@ sdl_stretch(int *w, int *h, int *x, int *y) static void -sdl_blit(int x, int y, int y1, int y2, int w, int h) +sdl_blit(int x, int y, int w, int h) { SDL_Rect r_src; int ret; - if (!sdl_enabled || (y1 == y2) || (h <= 0) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { + if (!sdl_enabled || (h <= 0) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { video_blit_complete(); return; } @@ -245,7 +245,7 @@ sdl_blit(int x, int y, int y1, int y2, int w, int h) r_src.y = y; r_src.w = w; r_src.h = h; - SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), (2048 + 64) * 4); + SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), (2048 + 64) * sizeof(uint32_t)); video_blit_complete(); SDL_RenderClear(sdl_render);