From: Toni Wilen Date: Sun, 10 Jul 2022 19:22:17 +0000 (+0300) Subject: RTG integer scaling support. X-Git-Tag: 41000~201 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8e9f1465117ce029c7c5343f7d782f37413999db;p=francis%2Fwinuae.git RTG integer scaling support. --- diff --git a/include/options.h b/include/options.h index d9251f12..6069d1fb 100644 --- a/include/options.h +++ b/include/options.h @@ -376,6 +376,7 @@ struct gfx_filterdata int gfx_filter_autoscale; int gfx_filter_integerscalelimit; int gfx_filter_keep_autoscale_aspect; + bool changed; }; #define MAX_DUPLICATE_EXPANSION_BOARDS 5 diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index ee03e219..3ab68c5a 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -1231,6 +1231,7 @@ #define IDC_RTG_THREAD 1800 #define IDC_PORT3_REMAP 1801 #define IDC_INPUTMAPOUT 1801 +#define IDC_RTG_INTEGERSCALE 1801 #define IDC_INFOBOX_TEXT2 1802 #define IDC_INPUTMAPOUTM 1802 #define IDC_INFOBOX_TEXT1 1803 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 9d7b1734..ea3594fd 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -1241,12 +1241,12 @@ BEGIN CONTROL "Scale if smaller than display size setting",IDC_RTG_SCALE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,130,175,10 CONTROL "Always scale in windowed mode",IDC_RTG_SCALE_ALLOW, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,143,170,10 - CONTROL "Always center",IDC_RTG_CENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,156,169,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,143,162,10 + CONTROL "Always center",IDC_RTG_CENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,156,162,10 CONTROL "Hardware vertical blank interrupt",IDC_RTG_VBINTERRUPT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,169,157,10 - CONTROL "Multithreaded",IDC_RTG_THREAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,156,83,10 - CONTROL "Hardware sprite emulation",IDC_RTG_HWSPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,169,148,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,169,129,10 + CONTROL "Multithreaded",IDC_RTG_THREAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,143,83,10 + CONTROL "Hardware sprite emulation",IDC_RTG_HWSPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,156,96,10 CTEXT "Color modes:",IDC_STATIC,295,81,83,10,SS_CENTERIMAGE COMBOBOX IDC_RTG_8BIT,296,96,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_RTG_16BIT,296,113,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP @@ -1259,6 +1259,7 @@ BEGIN COMBOBOX IDC_RTG_BUFFERCNT,153,227,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP CTEXT "Aspect ratio:",IDC_STATIC,282,212,83,10,SS_CENTERIMAGE COMBOBOX IDC_RTG_SCALE_ASPECTRATIO,282,227,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + CONTROL "Integer scaling",IDC_RTG_INTEGERSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,169,161,10 END IDD_INPUTMAP DIALOGEX 0, 0, 421, 341 diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index bb323518..cac252b6 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1558,10 +1558,10 @@ void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, i return; if (currprefs.gf[1].gfx_filter_horiz_zoom_mult > 0) { - picasso_offset_mx *= currprefs.gf[1].gfx_filter_horiz_zoom_mult * currprefs.gf[1].gfx_filter_horiz_zoom / 1000.0f; + picasso_offset_mx *= currprefs.gf[1].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 * currprefs.gf[1].gfx_filter_vert_zoom / 1000.0f; + picasso_offset_my *= currprefs.gf[1].gfx_filter_vert_zoom_mult; } if (!mon->scalepicasso) @@ -1580,17 +1580,18 @@ void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, i int divx = mon->currentmode.native_width / srcwidth; int divy = mon->currentmode.native_height / srcheight; int mul = divx > divy ? divy : divx; - int xx = srcwidth * mul; - int yy = srcheight * mul; SetRect (dr, 0, 0, mon->currentmode.native_width / mul, mon->currentmode.native_height / mul); - //picasso_offset_x = -(state->Width - xx) / 2; - //picasso_offset_y = -(mon->currentmode.native_height - srcheight) / 2; + int xx = (mon->currentmode.native_width / mul - srcwidth) / 2; + int yy = (mon->currentmode.native_height / mul - srcheight) / 2; + picasso_offset_x = -xx; + picasso_offset_y = -yy; mx = my = 1.0; } else if (mon->scalepicasso == RTG_MODE_CENTER) { int xx = (mon->currentmode.native_width - srcwidth) / 2; int yy = (mon->currentmode.native_height - srcheight) / 2; picasso_offset_x = -xx; picasso_offset_y = -yy; + SetRect (sr, 0, 0, mon->currentmode.native_width, mon->currentmode.native_height); SetRect (dr, 0, 0, mon->currentmode.native_width, mon->currentmode.native_height); mx = my = 1.0; } else { @@ -1825,8 +1826,6 @@ static void update_gfxparams(struct AmigaMonitor *mon) if (currprefs.gf[1].gfx_filter_vert_zoom_mult > 0) { my *= currprefs.gf[1].gfx_filter_vert_zoom_mult; } - mx = mx + mx * currprefs.gf[1].gfx_filter_horiz_zoom / 1000.0f; - my = my + my * currprefs.gf[1].gfx_filter_vert_zoom / 1000.0f; 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); currprefs.gfx_apmode[1].gfx_interlaced = false; @@ -1906,7 +1905,7 @@ static void update_gfxparams(struct AmigaMonitor *mon) mon->currentmode.current_height = currprefs.gfx_monitor[mon->monitor_id].gfx_size.height; } } else { - mon->scalepicasso = 2; + mon->scalepicasso = RTG_MODE_CENTER; 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; } diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 0a7617e3..df8e5788 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -11212,6 +11212,7 @@ static void enable_for_expansiondlg(HWND hDlg) ew(hDlg, IDC_RTG_MATCH_DEPTH, rtg3); ew(hDlg, IDC_RTG_SCALE, rtg2); ew(hDlg, IDC_RTG_CENTER, rtg2); + ew(hDlg, IDC_RTG_INTEGERSCALE, rtg2); ew(hDlg, IDC_RTG_SCALE_ALLOW, rtg2); ew(hDlg, IDC_RTG_SCALE_ASPECTRATIO, rtg2); ew(hDlg, IDC_RTG_VBLANKRATE, rtg2); @@ -11325,9 +11326,9 @@ static void values_to_expansiondlg(HWND hDlg) xSendDlgItemMessage(hDlg, IDC_RTG_VBLANKRATE, WM_SETTEXT, 0, (LPARAM) tmp); } - CheckDlgButton(hDlg, IDC_RTG_SCALE, workprefs.gf[1].gfx_filter_autoscale == RTG_MODE_SCALE); CheckDlgButton(hDlg, IDC_RTG_CENTER, workprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER); + CheckDlgButton(hDlg, IDC_RTG_INTEGERSCALE, workprefs.gf[1].gfx_filter_autoscale == RTG_MODE_INTEGER_SCALE); CheckDlgButton(hDlg, IDC_RTG_SCALE_ALLOW, workprefs.win32_rtgallowscaling); CheckDlgButton(hDlg, IDC_RTG_MATCH_DEPTH, workprefs.win32_rtgmatchdepth); CheckDlgButton(hDlg, IDC_RTG_VBINTERRUPT, workprefs.rtg_hardwareinterrupt); @@ -11455,21 +11456,28 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP switch (LOWORD (wParam)) { case IDC_RTG_MATCH_DEPTH: - workprefs.win32_rtgmatchdepth = ischecked (hDlg, IDC_RTG_MATCH_DEPTH); + workprefs.win32_rtgmatchdepth = ischecked(hDlg, IDC_RTG_MATCH_DEPTH); break; case IDC_RTG_SCALE: workprefs.gf[1].gfx_filter_autoscale = ischecked(hDlg, IDC_RTG_SCALE) ? RTG_MODE_SCALE : 0; - setchecked (hDlg, IDC_RTG_CENTER, false); + setchecked(hDlg, IDC_RTG_CENTER, false); + setchecked(hDlg, IDC_RTG_INTEGERSCALE, false); break; case IDC_RTG_CENTER: workprefs.gf[1].gfx_filter_autoscale = ischecked(hDlg, IDC_RTG_CENTER) ? RTG_MODE_CENTER : 0; - setchecked (hDlg, IDC_RTG_SCALE, false); + setchecked(hDlg, IDC_RTG_SCALE, false); + setchecked(hDlg, IDC_RTG_INTEGERSCALE, false); + break; + case IDC_RTG_INTEGERSCALE: + workprefs.gf[1].gfx_filter_autoscale = ischecked(hDlg, IDC_RTG_INTEGERSCALE) ? RTG_MODE_INTEGER_SCALE : 0; + setchecked(hDlg, IDC_RTG_SCALE, false); + setchecked(hDlg, IDC_RTG_CENTER, false); break; case IDC_RTG_SCALE_ALLOW: - workprefs.win32_rtgallowscaling = ischecked (hDlg, IDC_RTG_SCALE_ALLOW); + workprefs.win32_rtgallowscaling = ischecked(hDlg, IDC_RTG_SCALE_ALLOW); break; case IDC_RTG_VBINTERRUPT: - workprefs.rtg_hardwareinterrupt = ischecked (hDlg, IDC_RTG_VBINTERRUPT); + workprefs.rtg_hardwareinterrupt = ischecked(hDlg, IDC_RTG_VBINTERRUPT); break; case IDC_RTG_HWSPRITE: workprefs.rtg_hardwaresprite = ischecked(hDlg, IDC_RTG_HWSPRITE); @@ -19839,10 +19847,8 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog) xSendDlgItemMessage(hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)txt); WIN32GUI_LoadUIString(IDS_AUTOSCALE_CENTER, txt, sizeof (txt) / sizeof (TCHAR)); xSendDlgItemMessage(hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)txt); -#if 0 WIN32GUI_LoadUIString(IDS_AUTOSCALE_INTEGER, txt, sizeof (txt) / sizeof (TCHAR)); xSendDlgItemMessage(hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)txt); -#endif } xSendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_SETCURSEL, workprefs.gf[filter_nativertg].gfx_filter_autoscale, 0); xSendDlgItemMessage (hDlg, IDC_FILTERINTEGER, CB_SETCURSEL, workprefs.gf[filter_nativertg].gfx_filter_integerscalelimit, 0);