]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Integer scale updates
authorToni Wilen <twilen@winuae.net>
Sun, 23 Apr 2023 16:18:14 +0000 (19:18 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 23 Apr 2023 16:18:14 +0000 (19:18 +0300)
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp

index 574383fdb70e16b9c7fcb196af8fe23d53227e04..ceb8ffe4ea6f9bc4fcf42608316e1c5731dd295d 100644 (file)
@@ -218,24 +218,6 @@ static bool get_aspect(int monid, float *dstratiop, float *srcratiop, float *xmu
        return aspect;
 }
 
-static int res_match(int w)
-{
-       if (currprefs.gfx_vresolution == VRES_NONDOUBLE) {
-               if (currprefs.gfx_resolution == RES_HIRES) {
-                       w *= 2;
-               } else if (currprefs.gfx_resolution == RES_SUPERHIRES) {
-                       w *= 4;
-               }
-       } else {
-               if (currprefs.gfx_resolution == RES_LORES) {
-                       w /= 2;
-               } else if (currprefs.gfx_resolution == RES_SUPERHIRES) {
-                       w *= 2;
-               }
-       }
-       return w;
-}
-
 void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int *mode, int temp_width, int temp_height)
 {
        struct AmigaMonitor *mon = &AMonitors[monid];
@@ -447,8 +429,6 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                                filter_horiz_zoom_mult = 1.0;
                                filter_vert_zoom_mult = 1.0;
 
-                               maxw = res_match(maxw);
-
                                float multadd = 1.0f / (1 << currprefs.gf[idx].gfx_filter_integerscalelimit);
                                if (cw2 > maxw || ch2 > maxh) {
                                        while (cw2 / mult - adjw > maxw || ch2 / mult - adjh > maxh) {
@@ -461,11 +441,16 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int
                                        while (cw2 * (mult + multadd) - adjw <= maxw && ch2 * (mult + multadd) - adjh <= maxh) {
                                                mult += multadd;
                                        }
+
                                        float multx = mult, multy = mult;
                                        // if width is smaller than height, double width (programmed modes)
                                        if (cw2 * (mult + multadd) - adjw <= maxw && cw2 < ch2) {
                                                multx += multadd;
                                        }
+                                       // if width is >2.5x height, double height (non-doublescanned superhires)
+                                       if (ch2 * (mult + multadd) - adjh <= maxh && cw2 > ch2 * 2.5) {
+                                               multy += multadd;
+                                       }
                                        maxw = (int)((maxw + multx - multadd) / multx);
                                        maxh = (int)((maxh + multy - multadd) / multy);
                                }
index 317f95b5392c0e465002330496c5a2dc2e794ad8..b2c6ff5b39a955a33688be1251be12ce3b46662c 100644 (file)
@@ -1599,14 +1599,22 @@ void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int d
        if (mon->scalepicasso == RTG_MODE_INTEGER_SCALE) {
                int divx = mon->currentmode.native_width / srcwidth;
                int divy = mon->currentmode.native_height / srcheight;
-               int mul = !divx || !divy ? 1 : (divx > divy ? divy : divx);
-               SetRect(dr, 0, 0, mon->currentmode.native_width / mul, mon->currentmode.native_height / mul);
-               int xx = (mon->currentmode.native_width / mul - srcwidth) / 2;
-               int yy = (mon->currentmode.native_height / mul - srcheight) / 2;
+               float mul = (float)(!divx || !divy ? 1 : (divx > divy ? divy : divx));
+               if (!divx || !divy) {
+                       if ((float)mon->currentmode.native_width / srcwidth <= 0.95f || ((float)mon->currentmode.native_height / srcheight <= 0.95f)) {
+                               mul = 0.5f;
+                       }
+                       if ((float)mon->currentmode.native_width / srcwidth <= 0.45f || ((float)mon->currentmode.native_height / srcheight <= 0.45f)) {
+                               mul = 0.25f;
+                       }
+               }
+               SetRect(dr, 0, 0, (int)(mon->currentmode.native_width / mul), (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);
                picasso_offset_x = -xx;
                picasso_offset_y = -yy;
-               mx = (float)mul;
-               my = (float)mul;
+               mx = mul;
+               my = mul;
                outwidth = srcwidth;
                outheight = srcheight;
                *mode = 1;