Port PR#199 from pcem to 86Box.

Source: https://github.com/sarah-walker-pcem/pcem/pull/199
This commit is contained in:
Marek Knápek
2023-02-19 18:47:43 +01:00
parent 1ad8d1870b
commit 4248d80040
2 changed files with 19 additions and 29 deletions

View File

@@ -14,6 +14,7 @@
*
* Copyright 2008-2020 Sarah Walker.
*/
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
@@ -2267,9 +2268,10 @@ banshee_overlay_draw(svga_t *svga, int displine)
case VIDPROCCFG_FILTER_MODE_DITHER_4X4:
if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) {
uint8_t *fil = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t *fil3 = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t fil[64 * 3];
uint8_t fil3[64 * 3];
assert(svga->overlay_latch.cur_xsize <= 64);
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) /* leilei HACK - don't know of real 4x1 hscaled behavior yet, double for now */
{
for (x = 0; x < svga->overlay_latch.cur_xsize; x++) {
@@ -2320,9 +2322,6 @@ banshee_overlay_draw(svga_t *svga, int displine)
fil[(x) *3 + 2] = vb_filter_v1_rb[fil[x * 3 + 2]][fil3[(x + 1) * 3 + 2]];
p[x] = (fil[x * 3 + 2] << 16) | (fil[x * 3 + 1] << 8) | fil[x * 3];
}
free(fil);
free(fil3);
} else /* filter disabled by emulator option */
{
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) {
@@ -2339,15 +2338,16 @@ banshee_overlay_draw(svga_t *svga, int displine)
case VIDPROCCFG_FILTER_MODE_DITHER_2X2:
if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) {
uint8_t *fil = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t *soak = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t *soak2 = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t fil[64 * 3];
uint8_t soak[64 * 3];
uint8_t soak2[64 * 3];
uint8_t *samp1 = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t *samp2 = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t *samp3 = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t *samp4 = malloc((svga->overlay_latch.cur_xsize) * 3);
uint8_t samp1[64 * 3];
uint8_t samp2[64 * 3];
uint8_t samp3[64 * 3];
uint8_t samp4[64 * 3];
assert(svga->overlay_latch.cur_xsize <= 64);
src = &svga->vram[src_addr2 & svga->vram_mask];
OVERLAY_SAMPLE(banshee->overlay_buffer[1]);
for (x = 0; x < svga->overlay_latch.cur_xsize; x++) {
@@ -2395,14 +2395,6 @@ banshee_overlay_draw(svga_t *svga, int displine)
p[x] = (fil[x * 3 + 2] << 16) | (fil[x * 3 + 1] << 8) | fil[x * 3];
}
}
free(fil);
free(soak);
free(soak2);
free(samp1);
free(samp2);
free(samp3);
free(samp4);
} else /* filter disabled by emulator option */
{
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) {