From: Toni Wilen Date: Tue, 30 Jun 2026 18:54:39 +0000 (+0300) Subject: Support RTG integer scaling 1/x Filter panel option. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=d60c0c73e3afd60bfb886e6e13ba99e0889624e6;p=francis%2Fwinuae.git Support RTG integer scaling 1/x Filter panel option. --- diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 97d0802d..9a8d0d0b 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1497,25 +1497,50 @@ void getrtgfilterdata(int monid, struct displayscale *ds) float my = (float)mon->currentmode.native_height / srcheight; if (mon->scalepicasso == RTG_MODE_INTEGER_SCALE) { - int divx = mon->currentmode.native_width / srcwidth; - int divy = mon->currentmode.native_height / srcheight; - float mul = (float)(!divx || !divy ? 1 : (divx > divy ? divy : divx)); - if (!divx || !divy) { + float fdivx = (float)mon->currentmode.native_width / srcwidth; + float fdivy = (float)mon->currentmode.native_height / srcheight; + float fmul = (float)(fdivx < 1.0 || fdivy < 1.0 ? 1 : (fdivx > fdivy ? fdivy : fdivx)); + int mul = (int)(fmul * (1 << (currprefs.gf[GF_RTG].gfx_filter_integerscalelimit))); + fmul = (float)mul / (1 << (currprefs.gf[GF_RTG].gfx_filter_integerscalelimit)); + if (fdivx < 1.0 || fdivy < 1.0) { + float adjust = 0.5f / (1 << (currprefs.gf[GF_RTG].gfx_filter_integerscalelimit)); + fmul = 1.0f; + float prevfmul = fmul; + for(;;) { + if (fmul <= adjust) { + adjust /= 2.0f; + if (adjust < 0.10f) { + break; + } + } + fmul -= adjust; + if (fmul < 0.10f) { + fmul = 0.10f; + break; + } + if ((float)mon->currentmode.native_width / srcwidth > 2 * fmul || ((float)mon->currentmode.native_height / srcheight > 2 * fmul)) { + fmul = prevfmul; + break; + } + prevfmul = fmul; + } +#if 0 if ((float)mon->currentmode.native_width / srcwidth <= 0.95f || ((float)mon->currentmode.native_height / srcheight <= 0.95f)) { - mul = 0.5f; + fmul = 1.0f / 2.0f; } if ((float)mon->currentmode.native_width / srcwidth <= 0.45f || ((float)mon->currentmode.native_height / srcheight <= 0.45f)) { - mul = 0.25f; + fmul = 1.0f / 4.0f; } +#endif } - ds->outwidth = (int)(mon->currentmode.native_width / mul); - ds->outheight = (int)(mon->currentmode.native_height / mul); - int xx = (int)((mon->currentmode.native_width / mul - srcwidth) / 2); - int yy = (int)((mon->currentmode.native_height / mul - srcheight) / 2); + ds->outwidth = (int)(mon->currentmode.native_width / fmul); + ds->outheight = (int)(mon->currentmode.native_height / fmul); + int xx = (int)((mon->currentmode.native_width / fmul - srcwidth) / 2); + int yy = (int)((mon->currentmode.native_height / fmul - srcheight) / 2); picasso_offset_x = -xx; picasso_offset_y = -yy; - mx = mul; - my = mul; + mx = fmul; + my = fmul; outwidth = srcwidth; outheight = srcheight; ds->mode = 1; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index cfca462b..6ad2da7b 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -20474,15 +20474,16 @@ static void enable_for_hw3ddlg (HWND hDlg) int scalemode = workprefs.gf[filter_nativertg].gfx_filter_autoscale; int vv = FALSE, vv2 = FALSE, vv3 = FALSE, vv4 = FALSE; int as = FALSE; + bool rtg = filter_nativertg == GF_RTG; v = vv = vv2 = vv3 = vv4 = TRUE; - if (filter_nativertg == 1) { + if (rtg) { vv4 = FALSE; } if (scalemode == AUTOSCALE_STATIC_AUTO || scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_STATIC_MAX) as = TRUE; - if (filter_nativertg == 2) { + if (filter_nativertg == GF_INTERLACE) { ew(hDlg, IDC_FILTERENABLE, TRUE); setchecked(hDlg, IDC_FILTERENABLE, gf->enable); } else { @@ -20514,7 +20515,8 @@ static void enable_for_hw3ddlg (HWND hDlg) ew(hDlg, IDC_FILTERPRESETLOAD, filterpreset_selected > 0); ew(hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0); - ew(hDlg, IDC_FILTERINTEGER, scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE); + ew(hDlg, IDC_FILTERINTEGER, (!rtg && (scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE)) || + (rtg && scalemode == RTG_MODE_INTEGER_SCALE)); } static const TCHAR *filtermultnames[] = {