Removed the useless y1 and y2 parameters from the renderers' blit functions (and other places).

This commit is contained in:
OBattler
2021-09-13 23:19:10 +02:00
parent 7473a1c4b9
commit 96faa28eeb
31 changed files with 119 additions and 130 deletions

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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];

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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);
}