]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
RTG integer scaling support.
authorToni Wilen <twilen@winuae.net>
Sun, 10 Jul 2022 19:22:17 +0000 (22:22 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 10 Jul 2022 19:22:17 +0000 (22:22 +0300)
include/options.h
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32gfx.cpp
od-win32/win32gui.cpp

index d9251f124ecfd7aec41fe2d9649d3889a81205a6..6069d1fb76c87991d76b2aee5bbfe6351e7242b9 100644 (file)
@@ -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
index ee03e21980aa561da799466dee8fd981f0ce549c..3ab68c5a911c2663527b8a39fa82e4655f5daf1b 100644 (file)
 #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
index 9d7b17341078ab39777aec9d0c61300acfbecbf2..ea3594fd743ccda3a1f394f17f0f316c5de7656a 100644 (file)
@@ -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
index bb32351819faab99ab63e6e8041bfd9cd820c05f..cac252b6e167d46f6c71d7bc110990adfb439856 100644 (file)
@@ -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;
                                }
index 0a7617e38b8ee7740e02138f428c356e8e8733c5..df8e5788eaeda92723dd84838cd2b2b244defed6 100644 (file)
@@ -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);