From 5b09f38145ce1f893de24c7642fac5b486edc7a6 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 27 Nov 2022 10:45:40 +0200 Subject: [PATCH] RTG to non-lace switch filter change fix + cleanup. --- drawing.cpp | 18 ++++++++-------- include/options.h | 3 +++ od-win32/picasso96_win.cpp | 6 +++--- od-win32/win32gfx.cpp | 42 +++++++++++++++++++------------------- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index 1bbe7541..e90f586c 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -4862,10 +4862,10 @@ void check_prefs_picasso(void) if (!ad->picasso_on) { clear_inhibit_frame(monid, IHF_PICASSO); - ad->gf_index = ad->interlace_on ? 2 : 1; + ad->gf_index = ad->interlace_on ? GF_INTERLACE : GF_NORMAL; } else { set_inhibit_frame(monid, IHF_PICASSO); - ad->gf_index = 1; + ad->gf_index = GF_RTG; } gfx_set_picasso_state(monid, ad->picasso_on); @@ -5134,9 +5134,9 @@ bool notice_interlace_seen (int monid, bool lace) } if (changed) { - 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; + if (currprefs.gf[GF_INTERLACE].enable && memcmp(&currprefs.gf[GF_NORMAL], &currprefs.gf[GF_INTERLACE], sizeof(struct gfx_filterdata))) { + changed_prefs.gf[GF_NORMAL].changed = true; + changed_prefs.gf[GF_INTERLACE].changed = true; if (ad->interlace_on != interlace_on) { ad->interlace_on = interlace_on; set_config_changed(); @@ -5148,12 +5148,12 @@ bool notice_interlace_seen (int monid, bool lace) if (!ad->picasso_on) { if (ad->interlace_on) { - ad->gf_index = 2; + ad->gf_index = GF_INTERLACE; } else { - ad->gf_index = 0; + ad->gf_index = GF_NORMAL; } } else { - ad->gf_index = 1; + ad->gf_index = GF_RTG; } return changed; @@ -5269,7 +5269,7 @@ void drawing_init (void) if (!isrestore ()) { ad->picasso_on = 0; ad->picasso_requested_on = 0; - ad->gf_index = 0; + ad->gf_index = GF_NORMAL; gfx_set_picasso_state(0, 0); } #endif diff --git a/include/options.h b/include/options.h index f173b811..164d113f 100644 --- a/include/options.h +++ b/include/options.h @@ -352,6 +352,9 @@ struct apmode #define MAX_FILTERDATA 3 +#define GF_NORMAL 0 +#define GF_RTG 1 +#define GF_INTERLACE 2 struct gfx_filterdata { int enable; diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 17fcb4e3..46c253e0 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -826,8 +826,8 @@ static void mouseupdate(struct AmigaMonitor *mon) struct picasso96_state_struct *state = &picasso96_state[mon->monitor_id]; int x = newcursor_x; int y = newcursor_y; - float mx = currprefs.gf[1].gfx_filter_horiz_zoom_mult; - float my = currprefs.gf[1].gfx_filter_vert_zoom_mult; + float mx = currprefs.gf[GF_RTG].gfx_filter_horiz_zoom_mult; + float my = currprefs.gf[GF_RTG].gfx_filter_vert_zoom_mult; int forced = 0; if (!hwsprite) @@ -841,7 +841,7 @@ static void mouseupdate(struct AmigaMonitor *mon) } if (D3D_setcursor) { - if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER) { + if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_CENTER) { D3D_setcursor(mon->monitor_id, x, y, WIN32GFX_GetWidth(mon), WIN32GFX_GetHeight(mon), mx, my, cursorvisible, mon->scalepicasso == 2); } else { D3D_setcursor(mon->monitor_id, x, y, state->Width, state->Height, mx, my, cursorvisible, false); diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 1261a437..d7a621a0 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1574,11 +1574,11 @@ void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int d if (!ad->picasso_on) return; - if (currprefs.gf[1].gfx_filter_horiz_zoom_mult > 0) { - picasso_offset_mx *= currprefs.gf[1].gfx_filter_horiz_zoom_mult; + if (currprefs.gf[GF_RTG].gfx_filter_horiz_zoom_mult > 0) { + picasso_offset_mx *= currprefs.gf[GF_RTG].gfx_filter_horiz_zoom_mult; } - if (currprefs.gf[1].gfx_filter_vert_zoom_mult > 0) { - picasso_offset_my *= currprefs.gf[1].gfx_filter_vert_zoom_mult; + if (currprefs.gf[GF_RTG].gfx_filter_vert_zoom_mult > 0) { + picasso_offset_my *= currprefs.gf[GF_RTG].gfx_filter_vert_zoom_mult; } if (!mon->scalepicasso) @@ -1848,11 +1848,11 @@ static void update_gfxparams(struct AmigaMonitor *mon) if (mon->screen_is_picasso) { float mx = 1.0; float my = 1.0; - if (currprefs.gf[1].gfx_filter_horiz_zoom_mult > 0) { - mx *= currprefs.gf[1].gfx_filter_horiz_zoom_mult; + if (currprefs.gf[GF_RTG].gfx_filter_horiz_zoom_mult > 0) { + mx *= currprefs.gf[GF_RTG].gfx_filter_horiz_zoom_mult; } - if (currprefs.gf[1].gfx_filter_vert_zoom_mult > 0) { - my *= currprefs.gf[1].gfx_filter_vert_zoom_mult; + if (currprefs.gf[GF_RTG].gfx_filter_vert_zoom_mult > 0) { + my *= currprefs.gf[GF_RTG].gfx_filter_vert_zoom_mult; } mon->currentmode.current_width = (int)(state->Width * currprefs.rtg_horiz_zoom_mult * mx); mon->currentmode.current_height = (int)(state->Height * currprefs.rtg_vert_zoom_mult * my); @@ -1902,14 +1902,14 @@ static void update_gfxparams(struct AmigaMonitor *mon) if (mon->screen_is_picasso) { bool diff = state->Width != mon->currentmode.native_width || state->Height != mon->currentmode.native_height; if (isfullscreen () < 0) { - if ((currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER || currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_SCALE || currprefs.win32_rtgallowscaling) && diff) { + if ((currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_CENTER || currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_SCALE || currprefs.win32_rtgallowscaling) && diff) { mon->scalepicasso = RTG_MODE_SCALE; } - if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_INTEGER_SCALE && diff) { + if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_INTEGER_SCALE && diff) { mon->scalepicasso = RTG_MODE_INTEGER_SCALE; } - if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER && diff) { - mon->scalepicasso = currprefs.gf[1].gfx_filter_autoscale; + if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_CENTER && diff) { + mon->scalepicasso = currprefs.gf[GF_RTG].gfx_filter_autoscale; } if (!mon->scalepicasso && currprefs.win32_rtgscaleaspectratio) { mon->scalepicasso = -1; @@ -1917,23 +1917,23 @@ static void update_gfxparams(struct AmigaMonitor *mon) } else if (isfullscreen () > 0) { if (!canmatchdepth()) { // can't scale to different color depth if (mon->currentmode.native_width > state->Width && mon->currentmode.native_height > state->Height) { - if (currprefs.gf[1].gfx_filter_autoscale) + if (currprefs.gf[GF_RTG].gfx_filter_autoscale) mon->scalepicasso = RTG_MODE_SCALE; - if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_INTEGER_SCALE) { + if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_INTEGER_SCALE) { mon->scalepicasso = RTG_MODE_INTEGER_SCALE; } } - if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER) - mon->scalepicasso = currprefs.gf[1].gfx_filter_autoscale; + if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_CENTER) + mon->scalepicasso = currprefs.gf[GF_RTG].gfx_filter_autoscale; if (!mon->scalepicasso && currprefs.win32_rtgscaleaspectratio) mon->scalepicasso = -1; } } else if (isfullscreen () == 0) { - if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_INTEGER_SCALE) { + if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_INTEGER_SCALE) { mon->scalepicasso = RTG_MODE_INTEGER_SCALE; mon->currentmode.current_width = currprefs.gfx_monitor[mon->monitor_id].gfx_size.width; mon->currentmode.current_height = currprefs.gfx_monitor[mon->monitor_id].gfx_size.height; - } else if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER) { + } else if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_CENTER) { if (currprefs.gfx_monitor[mon->monitor_id].gfx_size.width < state->Width || currprefs.gfx_monitor[mon->monitor_id].gfx_size.height < state->Height) { if (!currprefs.win32_rtgallowscaling) { ; @@ -1947,7 +1947,7 @@ static void update_gfxparams(struct AmigaMonitor *mon) mon->currentmode.current_width = currprefs.gfx_monitor[mon->monitor_id].gfx_size.width; mon->currentmode.current_height = currprefs.gfx_monitor[mon->monitor_id].gfx_size.height; } - } else if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_SCALE) { + } else if (currprefs.gf[GF_RTG].gfx_filter_autoscale == RTG_MODE_SCALE) { if (currprefs.gfx_monitor[mon->monitor_id].gfx_size.width > state->Width || currprefs.gfx_monitor[mon->monitor_id].gfx_size.height > state->Height) mon->scalepicasso = RTG_MODE_SCALE; if ((currprefs.gfx_monitor[mon->monitor_id].gfx_size.width != state->Width || currprefs.gfx_monitor[mon->monitor_id].gfx_size.height != state->Height) && currprefs.win32_rtgallowscaling) { @@ -2905,7 +2905,7 @@ static int modeswitchneeded(struct AmigaMonitor *mon, struct winuae_currentmode if (state->BytesPerPixel > 1 && state->BytesPerPixel * 8 != wc->current_depth && canmatchdepth()) return -1; if (state->Width < wc->current_width && state->Height < wc->current_height) { - if ((currprefs.gf[1].gfx_filter_autoscale == 1 || (currprefs.gf[1].gfx_filter_autoscale == 2 && currprefs.win32_rtgallowscaling)) && !canmatchdepth()) + if ((currprefs.gf[GF_RTG].gfx_filter_autoscale == 1 || (currprefs.gf[GF_RTG].gfx_filter_autoscale == 2 && currprefs.win32_rtgallowscaling)) && !canmatchdepth()) return 0; } if (state->Width != wc->current_width || @@ -2933,7 +2933,7 @@ static int modeswitchneeded(struct AmigaMonitor *mon, struct winuae_currentmode } else { /* fullwindow to fullwindow */ if (mon->screen_is_picasso) { - if (currprefs.gf[1].gfx_filter_autoscale && ((wc->native_width > state->Width && wc->native_height >= state->Height) || (wc->native_height > state->Height && wc->native_width >= state->Width))) + if (currprefs.gf[GF_RTG].gfx_filter_autoscale && ((wc->native_width > state->Width && wc->native_height >= state->Height) || (wc->native_height > state->Height && wc->native_width >= state->Width))) return -1; if (currprefs.win32_rtgallowscaling && (state->Width != wc->native_width || state->Height != wc->native_height)) return -1; -- 2.47.3