]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Interpolation support, scaling fix.
authorToni Wilen <twilen@winuae.net>
Mon, 10 Apr 2023 13:49:08 +0000 (16:49 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 10 Apr 2023 13:49:08 +0000 (16:49 +0300)
od-win32/cloanto/RetroPlatformIPC.h
od-win32/rp.cpp

index 5634681631a70245c680a1c88f85c98a563c076c..dd8afdcbcc47cb7ae2bed383391f3961592da68a 100644 (file)
@@ -9,7 +9,7 @@
          : Software Foundation.
  Authors : os, m
  Created : 2007-08-27 13:55:49
- Updated : 2022-12-06 12:23:10
+ Updated : 2023-04-04 14:45:34
  Comment : RetroPlatform Player interprocess communication include file
  *****************************************************************************/
 
@@ -219,6 +219,7 @@ typedef struct RPScreenMode
 #define RP_SCREENMODE_SCALING_SUBPIXEL                 0x00100000 // use sub-pixel (non-integer) scaling in RP_SCREENMODE_SCALE_TARGET or RP_SCREENMODE_SCALE_MAX modes; if not set, up to four black bars may be added; if set, up to two black bars may be added
 #define RP_SCREENMODE_SCALING_STRETCH                  0x00200000 // "stretch to fill" (do not preserve original ratio) in RP_SCREENMODE_SCALE_TARGET or RP_SCREENMODE_SCALE_MAX modes; if set, no black bars are added
 #define RP_SCREENMODE_PIXEL_ORIGINAL_RATIO     0x00400000 // use pixel original ratio (when not set, square pixel ratio or a multiple thereof is used, which grants optimal sharpness and avoids screen distortions)
+#define RP_SCREENMODE_INTERPOLATION         0x00800000 // scale image using bilinear interpolation
 
 // Clip Flags (used only from host to guest, never from guest to host)
 #define RP_CLIPFLAGS_AUTOCLIP                          0x00000001 // ignore all 4 Clip values (same as all values = -1) and use "smart" offset and size
index fb6cea4b3ce622fb25bf5d2f502c110ecbed5655..53d47b1c39796c4e6f9e8b268a3011b83b8a7363 100644 (file)
@@ -854,8 +854,12 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool g
                m &= ~RP_SCREENMODE_DISPLAYMASK;
                m |= p->gfx_apmode[rtg ? APMODE_RTG : APMODE_NATIVE].gfx_display << 8;
        }
-       if (full > 1)
+       if (full > 1) {
                m |= RP_SCREENMODE_FULLSCREEN_SHARED;
+       }
+       if (p->gf[rtg].gfx_filter_bilinear) {
+               m |= RP_SCREENMODE_INTERPOLATION;
+       }
 
        sm->dwScreenMode = m | (storeflags & (RP_SCREENMODE_SCALING_STRETCH | RP_SCREENMODE_SCALING_SUBPIXEL));
        sm->lTargetHeight = 0;
@@ -872,7 +876,7 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool g
        sm->dwClipFlags = cf;
 
        if (log_rp & 2) {
-               write_log (_T("%sGET_RPSM: hres=%d (%d) vres=%d (%d) full=%d xcpos=%d ycpos=%d w=%d h=%d vm=%d hm=%d half=%d\n"),
+               write_log (_T("%sGET_RPSM: hres=%d (%d) vres=%d (%d) full=%d xcpos=%d ycpos=%d w=%d h=%d vm=%.2f hm=%.2f half=%d\n"),
                        rtg ? _T("RTG ") : _T(""),
                        totalhdbl, hres, totalvdbl, vres, full,
                        p->gfx_xcenter_pos,  p->gfx_ycenter_pos,
@@ -990,7 +994,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                                vres = max_vert_dbl;
                        }
 
-                       if (smm_m > RP_SCREENMODE_SCALE_4X) {
+                       if (smm_m > RP_SCREENMODE_SCALE_4X && smm < RP_SCREENMODE_SCALE_TARGET) {
                                xtramult = (smm_m + 1.0f) / 4.0f;
                                hmult *= xtramult;
                                vmult *= xtramult;
@@ -1071,6 +1075,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
 
                p->win32_rtgallowscaling = false;
                p->win32_rtgscaleaspectratio = keepaspect ? -1 : 0;
+               p->gf[GF_RTG].gfx_filter_bilinear = (sm->dwScreenMode & RP_SCREENMODE_INTERPOLATION) != 0;
 
                if (integerscale) {
                        p->gf[GF_RTG].gfx_filter_autoscale = RTG_MODE_INTEGER_SCALE;
@@ -1167,6 +1172,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                        p->gf[0].gfx_filter_left_border = -1;
                        p->gf[0].gfx_filter_top_border = -1;
                }
+               p->gf[0].gfx_filter_bilinear = (sm->dwScreenMode & RP_SCREENMODE_INTERPOLATION) != 0;
        }
 
        if (log_rp & 2) {
@@ -1771,9 +1777,7 @@ static void sendfeatures (void)
        feat = RP_FEATURE_POWERLED | RP_FEATURE_SCREEN1X | RP_FEATURE_FULLSCREEN;
        feat |= RP_FEATURE_PAUSE | RP_FEATURE_TURBO_CPU | RP_FEATURE_TURBO_FLOPPY | RP_FEATURE_VOLUME | RP_FEATURE_SCREENCAPTURE;
        feat |= RP_FEATURE_DEVICEREADWRITE;
-       if (currprefs.gfx_api) {
-               feat |= RP_FEATURE_SCREENOVERLAY;
-       }
+       feat |= RP_FEATURE_SCREENOVERLAY;
        if (WIN32GFX_IsPicassoScreen(mon)) {
                feat |= RP_FEATURE_SCREEN2X | RP_FEATURE_SCREEN3X | RP_FEATURE_SCREEN4X;
        } else {