}
#ifdef GFXFILTER
- struct gfx_filterdata *fd = &currprefs.gf[0];
- struct gfx_filterdata *fdcp = &changed_prefs.gf[0];
-
- fd->gfx_filter_horiz_zoom = fdcp->gfx_filter_horiz_zoom;
- fd->gfx_filter_vert_zoom = fdcp->gfx_filter_vert_zoom;
- fd->gfx_filter_horiz_offset = fdcp->gfx_filter_horiz_offset;
- fd->gfx_filter_vert_offset = fdcp->gfx_filter_vert_offset;
- fd->gfx_filter_scanlines = fdcp->gfx_filter_scanlines;
-
- fd->gfx_filter_left_border = fdcp->gfx_filter_left_border;
- fd->gfx_filter_right_border = fdcp->gfx_filter_right_border;
- fd->gfx_filter_top_border = fdcp->gfx_filter_top_border;
- fd->gfx_filter_bottom_border = fdcp->gfx_filter_bottom_border;
+ for (int i = 0; i < 2; i++) {
+ int idx = i == 0 ? 0 : 2;
+ struct gfx_filterdata *fd = &currprefs.gf[idx];
+ struct gfx_filterdata *fdcp = &changed_prefs.gf[idx];
+
+ fd->gfx_filter_horiz_zoom = fdcp->gfx_filter_horiz_zoom;
+ fd->gfx_filter_vert_zoom = fdcp->gfx_filter_vert_zoom;
+ fd->gfx_filter_horiz_offset = fdcp->gfx_filter_horiz_offset;
+ fd->gfx_filter_vert_offset = fdcp->gfx_filter_vert_offset;
+ fd->gfx_filter_scanlines = fdcp->gfx_filter_scanlines;
+
+ fd->gfx_filter_left_border = fdcp->gfx_filter_left_border;
+ fd->gfx_filter_right_border = fdcp->gfx_filter_right_border;
+ fd->gfx_filter_top_border = fdcp->gfx_filter_top_border;
+ fd->gfx_filter_bottom_border = fdcp->gfx_filter_bottom_border;
+ }
#endif
}
void check_custom_limits(void)
{
- struct gfx_filterdata *fd = &currprefs.gf[0];
+ struct amigadisplay *ad = &adisplays[0];
+ struct gfx_filterdata *fd = &currprefs.gf[ad->gf_index];
int vls = visible_left_start;
int vrs = visible_right_stop;
int vts = visible_top_start;
void set_custom_limits (int w, int h, int dx, int dy, bool blank)
{
- struct gfx_filterdata *fd = &currprefs.gf[0];
+ struct amigadisplay *ad = &adisplays[0];
+ struct gfx_filterdata *fd = &currprefs.gf[ad->gf_index];
int vls = visible_left_start;
int vrs = visible_right_stop;
int vts = visible_top_start;
static void center_image (void)
{
struct amigadisplay *ad = &adisplays[0];
+ struct gfx_filterdata *fd = &currprefs.gf[ad->gf_index];
struct vidbuf_description *vidinfo = &ad->gfxvidinfo;
int prev_x_adjust = visible_left_border;
int prev_y_adjust = thisframe_y_adjust;
int ew = vidinfo->drawbuffer.extrawidth;
int maxdiw = max_diwlastword;
- if (currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN && currprefs.gfx_xcenter && !currprefs.gf[0].gfx_filter_autoscale && max_diwstop > 0) {
+ if (currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN && currprefs.gfx_xcenter && !fd->gfx_filter_autoscale && max_diwstop > 0) {
if (max_diwstop - min_diwstart < w && currprefs.gfx_xcenter == 2)
/* Try to center. */
max_drawn_amiga_line_tmp >>= linedbl;
thisframe_y_adjust = minfirstline;
- if (currprefs.gfx_ycenter && !currprefs.gf[0].gfx_filter_autoscale) {
+ if (currprefs.gfx_ycenter && !fd->gfx_filter_autoscale) {
if (thisframe_first_drawn_line >= 0 && thisframe_last_drawn_line > thisframe_first_drawn_line) {
ad->picasso_requested_forced_on = false;
ad->picasso_on = ad->picasso_requested_on;
- if (!ad->picasso_on)
+ if (!ad->picasso_on) {
clear_inhibit_frame(monid, IHF_PICASSO);
- else
+ ad->gf_index = ad->interlace_on ? 2 : 1;
+ } else {
set_inhibit_frame(monid, IHF_PICASSO);
+ ad->gf_index = 1;
+ }
gfx_set_picasso_state(monid, ad->picasso_on);
picasso_enablescreen(monid, ad->picasso_requested_on);
if (currprefs.gf[2].enable && memcmp(&currprefs.gf[0], &currprefs.gf[2], sizeof(struct gfx_filterdata))) {
changed_prefs.gf[0].changed = true;
changed_prefs.gf[2].changed = true;
- ad->interlace_on = interlace_on;
- set_config_changed();
+ if (ad->interlace_on != interlace_on) {
+ ad->interlace_on = interlace_on;
+ set_config_changed();
+ }
} else {
ad->interlace_on = false;
}
}
+ if (!ad->picasso_on) {
+ if (ad->interlace_on) {
+ ad->gf_index = 2;
+ } else {
+ ad->gf_index = 0;
+ }
+ } else {
+ ad->gf_index = 1;
+ }
+
return changed;
}
if (!isrestore ()) {
ad->picasso_on = 0;
ad->picasso_requested_on = 0;
+ ad->gf_index = 0;
gfx_set_picasso_state(0, 0);
}
#endif
static void video_calc_gammatable(int monid)
{
struct amigadisplay *ad = &adisplays[monid];
+ struct gfx_filterdata *fd = &currprefs.gf[ad->gf_index];
float bri, con, gam, gams[3];
float max = 255;
gams[1] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[1])) / 1000.0f;
gams[2] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[2])) / 1000.0f;
- lf = 64 * currprefs.gf[ad->picasso_on].gfx_filter_blur / 1000;
+ lf = 64 * currprefs.gf[ad->gf_index].gfx_filter_blur / 1000;
hf = 256 - lf * 2;
for (int i = 0; i < (256 * 3); i++) {
{
struct amigadisplay *ad = &adisplays[monid];
if (!gfx_hdr) {
- v = v * (float)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0f + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0f;
+ v = v * (float)(currprefs.gf[ad->gf_index].gfx_filter_contrast + 1000) / 1000.0f + currprefs.gf[ad->gf_index].gfx_filter_luminance / 10.0f;
}
if (v < 0)
v = 0;
{
struct amigadisplay *ad = &adisplays[monid];
if (!gfx_hdr) {
- v *= (float)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0f;
+ v *= (float)(currprefs.gf[ad->gf_index].gfx_filter_saturation + 1000) / 1000.0f;
}
if (v < -128)
v = -128;
bool picasso_requested_forced_on;
bool picasso_on;
bool interlace_on;
+ int gf_index;
int picasso_redraw_necessary;
int custom_frame_redraw_necessary;
int frame_redraw_necessary;
struct apmode ap;
D3DADAPTER_IDENTIFIER9 did;
- d3d->filterd3didx = ad->picasso_on ? 1 : (ad->interlace_on ? 2 : 0);
+ d3d->filterd3didx = ad->gf_index;
d3d->filterd3d = &currprefs.gf[d3d->filterd3didx];
D3D_free2 (d3d);
write_log(_T("D3D11 init start. (%d*%d) (%d*%d) RTG=%d Depth=%d.\n"), w_w, w_h, t_w, t_h, ad->picasso_on, depth);
- d3d->filterd3didx = ad->picasso_on ? 1 : (ad->interlace_on ? 2 : 0);
+ d3d->filterd3didx = ad->gf_index;
d3d->filterd3d = &currprefs.gf[d3d->filterd3didx];
d3d->delayedfs = 0;
xx2 = 5;
xx3 = 7;
}
- pal_noise_mask = (1 << (currprefs.gf[ad->picasso_on].gfx_filter_noise * 7 / 100)) - 1;
- scanlinelevel = 128 - currprefs.gf[ad->picasso_on].gfx_filter_scanlines * 128 / 100;
+ pal_noise_mask = (1 << (currprefs.gf[ad->gf_index].gfx_filter_noise * 7 / 100)) - 1;
+ scanlinelevel = 128 - currprefs.gf[ad->gf_index].gfx_filter_scanlines * 128 / 100;
}
#if 0
*chp = ch;
}
-static bool get_auto_aspect_ratio(int monid, int cw, int ch, int crealh, int scalemode, float *autoaspectratio)
+static bool get_auto_aspect_ratio(int monid, int cw, int ch, int crealh, int scalemode, float *autoaspectratio, int idx)
{
- struct amigadisplay *ad = &adisplays[monid];
*autoaspectratio = 0;
- if (currprefs.gf[ad->picasso_on].gfx_filter_keep_autoscale_aspect && cw > 0 && ch > 0 && crealh > 0 && (scalemode == AUTOSCALE_NORMAL ||
+ if (currprefs.gf[idx].gfx_filter_keep_autoscale_aspect && cw > 0 && ch > 0 && crealh > 0 && (scalemode == AUTOSCALE_NORMAL ||
scalemode == AUTOSCALE_INTEGER_AUTOSCALE || scalemode == AUTOSCALE_MANUAL)) {
float cw2 = (float)cw;
float ch2 = (float)ch;
int extraw2;
bool doautoaspect = false;
float autoaspectratio;
- int keep_aspect = currprefs.gf[ad->picasso_on].gfx_filter_keep_aspect;
- int filter_aspect = currprefs.gf[ad->picasso_on].gfx_filter_aspect;
+ int idx = ad->gf_index;
+ int keep_aspect = currprefs.gf[idx].gfx_filter_keep_aspect;
+ int filter_aspect = currprefs.gf[idx].gfx_filter_aspect;
int palntscadjust = 1;
int autoselect = 0;
- float filter_horiz_zoom = currprefs.gf[ad->picasso_on].gfx_filter_horiz_zoom / 1000.0f;
- float filter_vert_zoom = currprefs.gf[ad->picasso_on].gfx_filter_vert_zoom / 1000.0f;
- float filter_horiz_zoom_mult = currprefs.gf[ad->picasso_on].gfx_filter_horiz_zoom_mult;
- float filter_vert_zoom_mult = currprefs.gf[ad->picasso_on].gfx_filter_vert_zoom_mult;
- float filter_horiz_offset = currprefs.gf[ad->picasso_on].gfx_filter_horiz_offset / 10000.0f;
- float filter_vert_offset = currprefs.gf[ad->picasso_on].gfx_filter_vert_offset / 10000.0f;
+ float filter_horiz_zoom = currprefs.gf[idx].gfx_filter_horiz_zoom / 1000.0f;
+ float filter_vert_zoom = currprefs.gf[idx].gfx_filter_vert_zoom / 1000.0f;
+ float filter_horiz_zoom_mult = currprefs.gf[idx].gfx_filter_horiz_zoom_mult;
+ float filter_vert_zoom_mult = currprefs.gf[idx].gfx_filter_vert_zoom_mult;
+ float filter_horiz_offset = currprefs.gf[idx].gfx_filter_horiz_offset / 10000.0f;
+ float filter_vert_offset = currprefs.gf[idx].gfx_filter_vert_offset / 10000.0f;
store_custom_limits (-1, -1, -1, -1);
*mode = 0;
aws = aw * scale;
ahs = ah * scale;
//write_log (_T("%d %d %d\n"), dst_width, temp_width, aws);
- extraw = (int)(-aws * (filter_horiz_zoom - currprefs.gf[ad->picasso_on].gfx_filteroverlay_overscan * 10) / 2.0f);
- extrah = (int)(-ahs * (filter_vert_zoom - currprefs.gf[ad->picasso_on].gfx_filteroverlay_overscan * 10) / 2.0f);
+ extraw = (int)(-aws * (filter_horiz_zoom - currprefs.gf[idx].gfx_filteroverlay_overscan * 10) / 2.0f);
+ extrah = (int)(-ahs * (filter_vert_zoom - currprefs.gf[idx].gfx_filteroverlay_overscan * 10) / 2.0f);
extraw2 = 0;
if (D3D_getscalerect && D3D_getscalerect(monid, &mrmx, &mrmy, &mrsx, &mrsy, avidinfo->outbuffer->inwidth2, avidinfo->outbuffer->inheight2)) {
float xmult = filter_horiz_zoom_mult;
float ymult = filter_vert_zoom_mult;
- int scalemode = currprefs.gf[ad->picasso_on].gfx_filter_autoscale;
- int oscalemode = changed_prefs.gf[ad->picasso_on].gfx_filter_autoscale;
+ int scalemode = currprefs.gf[idx].gfx_filter_autoscale;
+ int oscalemode = changed_prefs.gf[idx].gfx_filter_autoscale;
if (scalemode == AUTOSCALE_OVERSCAN_BLANK) {
oscalemode = scalemode = AUTOSCALE_NONE;
}
bool ok = true;
if (currprefs.gfx_xcenter_pos >= 0 || currprefs.gfx_ycenter_pos >= 0) {
- changed_prefs.gf[ad->picasso_on].gfx_filter_horiz_offset = currprefs.gf[ad->picasso_on].gfx_filter_horiz_offset = 0.0;
- changed_prefs.gf[ad->picasso_on].gfx_filter_vert_offset = currprefs.gf[ad->picasso_on].gfx_filter_vert_offset = 0.0;
+ changed_prefs.gf[idx].gfx_filter_horiz_offset = currprefs.gf[idx].gfx_filter_horiz_offset = 0.0;
+ changed_prefs.gf[idx].gfx_filter_vert_offset = currprefs.gf[idx].gfx_filter_vert_offset = 0.0;
filter_horiz_offset = 0.0;
filter_vert_offset = 0.0;
get_custom_topedge (&cx, &cy, false);
maxw = res_match(maxw);
- float multadd = 1.0f / (1 << currprefs.gf[ad->picasso_on].gfx_filter_integerscalelimit);
+ float multadd = 1.0f / (1 << currprefs.gf[idx].gfx_filter_integerscalelimit);
if (cw2 > maxw || ch2 > maxh) {
while (cw2 / mult > maxw || ch2 / mult > maxh)
mult += multadd;
} else if (scalemode == AUTOSCALE_MANUAL) {
- changed_prefs.gf[ad->picasso_on].gfx_filter_horiz_offset = currprefs.gf[ad->picasso_on].gfx_filter_horiz_offset = 0.0;
- changed_prefs.gf[ad->picasso_on].gfx_filter_vert_offset = currprefs.gf[ad->picasso_on].gfx_filter_vert_offset = 0.0;
+ changed_prefs.gf[idx].gfx_filter_horiz_offset = currprefs.gf[idx].gfx_filter_horiz_offset = 0.0;
+ changed_prefs.gf[idx].gfx_filter_vert_offset = currprefs.gf[idx].gfx_filter_vert_offset = 0.0;
filter_horiz_offset = 0.0;
filter_vert_offset = 0.0;
}
if (!autoaspect_done) {
- doautoaspect = get_auto_aspect_ratio(monid, cw, ch, crealh, scalemode, &autoaspectratio);
+ doautoaspect = get_auto_aspect_ratio(monid, cw, ch, crealh, scalemode, &autoaspectratio, idx);
}
if (cv) {
OffsetRect (zr, cx * scale - (dst_width - ww) / 2, cy * scale - (dst_height - hh) / 2);
goto cont;
- } else if (scalemode == AUTOSCALE_RESIZE && isfullscreen() == 0 && !currprefs.gf[ad->picasso_on].gfx_filteroverlay[0]) {
+ } else if (scalemode == AUTOSCALE_RESIZE && isfullscreen() == 0 && !currprefs.gf[idx].gfx_filteroverlay[0]) {
static int lastresize = 0;
static int lastdelay = 1;
lastresize = AUTORESIZE_FRAME_DELAY;
lastdelay = 0;
}
- float scalex = currprefs.gf[ad->picasso_on].gfx_filter_horiz_zoom_mult > 0 ? currprefs.gf[ad->picasso_on].gfx_filter_horiz_zoom_mult : 1.0f;
- float scaley = currprefs.gf[ad->picasso_on].gfx_filter_vert_zoom_mult > 0 ? currprefs.gf[ad->picasso_on].gfx_filter_vert_zoom_mult : 1.0f;
+ float scalex = currprefs.gf[idx].gfx_filter_horiz_zoom_mult > 0 ? currprefs.gf[idx].gfx_filter_horiz_zoom_mult : 1.0f;
+ float scaley = currprefs.gf[idx].gfx_filter_vert_zoom_mult > 0 ? currprefs.gf[idx].gfx_filter_vert_zoom_mult : 1.0f;
SetRect (sr, 0, 0, (int)(cw * scale * scalex), (int)(ch * scale * scaley));
dr->left = (temp_width - aws) /2;
dr->top = (temp_height - ahs) / 2;
struct vidbuffer *vb = avidinfo->outbuffer;
struct AmigaMonitor *mon = &AMonitors[monid];
struct uae_filter *usedfilter = mon->usedfilter;
+ int idx = ad->gf_index;
int flags = 0;
dst_width2 = dw;
if (WIN32GFX_IsPicassoScreen(mon))
return true;
- if (!currprefs.gf[ad->picasso_on].gfx_filter || !usedfilter) {
+ if (!currprefs.gf[idx].gfx_filter || !usedfilter) {
usedfilter = &uaefilters[0];
scale = 1;
} else {
if ((amiga_depth2 == 16 && !(flags & UAE_FILTER_MODE_16)) || (amiga_depth2 == 32 && !(flags & UAE_FILTER_MODE_32))) {
usedfilter = &uaefilters[0];
scale = 1;
- changed_prefs.gf[ad->picasso_on].gfx_filter = usedfilter->type;
+ changed_prefs.gf[idx].gfx_filter = usedfilter->type;
}
}
#if 0
amiga_height = vb->outheight;
amiga_depth = vb->pixbytes * 8;
- int mh = currprefs.gf[ad->picasso_on].gfx_filter_filtermodeh + 1;
+ int mh = currprefs.gf[idx].gfx_filter_filtermodeh + 1;
if (mh < scale)
mh = scale;
temp_width = dst_width * mh;
- int mv = currprefs.gf[ad->picasso_on].gfx_filter_filtermodev + 1;
+ int mv = currprefs.gf[idx].gfx_filter_filtermodev + 1;
if (mv < scale)
mv = scale;
temp_height = dst_height * mv;
struct uae_filter *usedfilter = mon->usedfilter;
struct vidbuf_description *avidinfo = &adisplays[monid].gfxvidinfo;
struct vidbuffer *vb = avidinfo->outbuffer;
+ int idx = ad->gf_index;
int aw, ah, aws, ahs;
uae_u8 *dptr, *enddptr, *sptr, *endsptr;
int ok = 0;
}
- if (ok == 0 && currprefs.gf[ad->picasso_on].gfx_filter) {
+ if (ok == 0 && currprefs.gf[idx].gfx_filter) {
usedfilter = &uaefilters[0];
- changed_prefs.gf[ad->picasso_on].gfx_filter = usedfilter->type;
+ changed_prefs.gf[idx].gfx_filter = usedfilter->type;
}
end:;
}
}
}
}
+ if (currprefs.gf[2].enable != changed_prefs.gf[2].enable) {
+ currprefs.gf[2].enable = changed_prefs.gf[2].enable;
+ c |= 512;
+ }
+
monitors[0] = true;
#if 0
return 1;
}
- if (currprefs.gf[0].gfx_filter_autoscale != changed_prefs.gf[0].gfx_filter_autoscale ||
+ if (
+ currprefs.gf[0].gfx_filter_autoscale != changed_prefs.gf[0].gfx_filter_autoscale ||
+ currprefs.gf[2].gfx_filter_autoscale != changed_prefs.gf[2].gfx_filter_autoscale ||
currprefs.gfx_xcenter_pos != changed_prefs.gfx_xcenter_pos ||
currprefs.gfx_ycenter_pos != changed_prefs.gfx_ycenter_pos ||
currprefs.gfx_xcenter_size != changed_prefs.gfx_xcenter_size ||
currprefs.gfx_xcenter = changed_prefs.gfx_xcenter;
currprefs.gfx_ycenter = changed_prefs.gfx_ycenter;
currprefs.gf[0].gfx_filter_autoscale = changed_prefs.gf[0].gfx_filter_autoscale;
+ currprefs.gf[2].gfx_filter_autoscale = changed_prefs.gf[2].gfx_filter_autoscale;
get_custom_limits (NULL, NULL, NULL, NULL, NULL);
fixup_prefs_dimensions (&changed_prefs);
#ifdef GFXFILTER
*usedfilter = NULL;
- if (currprefs.gf[ad->picasso_on].gfx_filter > 0) {
+ if (currprefs.gf[ad->gf_index].gfx_filter > 0) {
int i = 0;
while (uaefilters[i].name) {
- if (uaefilters[i].type == currprefs.gf[ad->picasso_on].gfx_filter) {
+ if (uaefilters[i].type == currprefs.gf[ad->gf_index].gfx_filter) {
*usedfilter = &uaefilters[i];
break;
}
oldtex_w[i] = oldtex_h[i] = -1;
}
if (mon->currentmode.flags & DM_D3D) {
- int fmh = mon->screen_is_picasso ? 1 : currprefs.gf[ad->picasso_on].gfx_filter_filtermodeh + 1;
- int fmv = mon->screen_is_picasso ? 1 : currprefs.gf[ad->picasso_on].gfx_filter_filtermodev + 1 - 1;
- if (currprefs.gf[ad->picasso_on].gfx_filter_filtermodev == 0) {
+ int fmh = mon->screen_is_picasso ? 1 : currprefs.gf[ad->gf_index].gfx_filter_filtermodeh + 1;
+ int fmv = mon->screen_is_picasso ? 1 : currprefs.gf[ad->gf_index].gfx_filter_filtermodev + 1 - 1;
+ if (currprefs.gf[ad->gf_index].gfx_filter_filtermodev == 0) {
fmv = fmh;
}
int errv = 0;
} else if (currprefs.gfx_api > 0) {
changed_prefs.gfx_api = currprefs.gfx_api = 0;
changed_prefs.color_mode = currprefs.color_mode = 5;
- changed_prefs.gf[ad->picasso_on].gfx_filter = currprefs.gf[ad->picasso_on].gfx_filter = 1;
+ changed_prefs.gf[ad->gf_index].gfx_filter = currprefs.gf[ad->gf_index].gfx_filter = 1;
update_gfxparams(mon);
d3d_select(&currprefs);
error_log(_T("Direct3D9/11 failed to initialize ('%s'), falling back to GDI."), err);