[PATCH 3/7] Replace "Linear scaling" GUI option with "GPU scaling" one

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Remove 'nRenderScaleQuality' config option now that scaling will
automatically request nearest pixel or linear scaling filtering
depending on which one is more suitable (and because all SDL2 backends
don't support linear scaling hint).

To minimize GUI changes, corresponding "Linear scaling" option was
replaced with the "GPU scaling" GUI option for toggling the
'bUseSdlRenderer' config option that enables use of the SDL2 GL(ES)
/ DirectX renderer (needed for ScaleQuality, window resizing etc).
---
 src/change.c                     |  2 +-
 src/configuration.c              |  2 --
 src/gui-osx/PrefsController.h    |  2 +-
 src/gui-osx/PrefsController.m    |  4 ++--
 src/gui-osx/en.lproj/SDLMain.xib |  4 ++--
 src/gui-osx/fr.lproj/SDLMain.xib |  4 ++--
 src/gui-sdl/dlgScreen.c          | 12 ++++++------
 src/includes/configuration.h     |  1 -
 src/screen.c                     |  3 ---
 9 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/src/change.c b/src/change.c
index d50fe801..96211d04 100644
--- a/src/change.c
+++ b/src/change.c
@@ -209,7 +209,7 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
 	     || changed->Screen.bAllowOverscan != current->Screen.bAllowOverscan
 	     || changed->Screen.bShowStatusbar != current->Screen.bShowStatusbar
 #if WITH_SDL2
-	     || changed->Screen.nRenderScaleQuality != current->Screen.nRenderScaleQuality
+	     || changed->Screen.bUseSdlRenderer != current->Screen.bUseSdlRenderer
 	     || changed->Screen.bResizable != current->Screen.bResizable
 	     || changed->Screen.bUseVsync != current->Screen.bUseVsync
 #endif
diff --git a/src/configuration.c b/src/configuration.c
index 62798053..dd500e37 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -101,7 +101,6 @@ static const struct Config_Tag configs_Screen[] =
 #if WITH_SDL2
 	{ "nZoomFactor", Float_Tag, &ConfigureParams.Screen.nZoomFactor },
 	{ "bUseSdlRenderer", Bool_Tag, &ConfigureParams.Screen.bUseSdlRenderer },
-	{ "nRenderScaleQuality", Int_Tag, &ConfigureParams.Screen.nRenderScaleQuality },
 	{ "bUseVsync", Bool_Tag, &ConfigureParams.Screen.bUseVsync },
 #endif
 	{ NULL , Error_Tag, NULL }
@@ -843,7 +842,6 @@ void Configuration_SetDefault(void)
 #if WITH_SDL2
 	ConfigureParams.Screen.nZoomFactor = 1.0;
 	ConfigureParams.Screen.bUseSdlRenderer = true;
-	ConfigureParams.Screen.nRenderScaleQuality = 0;
 	ConfigureParams.Screen.bUseVsync = false;
 #endif
 
diff --git a/src/gui-osx/PrefsController.h b/src/gui-osx/PrefsController.h
index 69bae7f1..3d4e3791 100644
--- a/src/gui-osx/PrefsController.h
+++ b/src/gui-osx/PrefsController.h
@@ -60,7 +60,7 @@
 	IBOutlet NSTextField *maxZoomedWidth;				// N
 	IBOutlet NSTextField *maxZoomedHeight;				// N
 	IBOutlet NSButton *keepDesktopResolution;
-	IBOutlet NSButton *SDL2UseLinearScaling;
+	IBOutlet NSButton *SDL2UseGpuScaling;
 	IBOutlet NSButton *SDL2Resizable ;
 	IBOutlet NSButton *SDL2UseVSync ;
 
diff --git a/src/gui-osx/PrefsController.m b/src/gui-osx/PrefsController.m
index 5fef6cce..89dabac5 100644
--- a/src/gui-osx/PrefsController.m
+++ b/src/gui-osx/PrefsController.m
@@ -789,7 +789,7 @@ BOOL flag1, flag2;
 	IMPORT_RADIO(YMVoicesMixing,ConfigureParams.Sound.YmVolumeMixing);
 
 #if WITH_SDL2
-	IMPORT_SWITCH(SDL2UseLinearScaling, ConfigureParams.Screen.nRenderScaleQuality);
+	IMPORT_SWITCH(SDL2UseGpuScaling, ConfigureParams.Screen.bUseSdlRenderer);
 	IMPORT_SWITCH(SDL2Resizable, ConfigureParams.Screen.bResizable);
 	IMPORT_SWITCH(SDL2UseVSync, ConfigureParams.Screen.bUseVsync);
 #endif
@@ -1061,7 +1061,7 @@ BOOL flag1, flag2;
 	EXPORT_RADIO(YMVoicesMixing,ConfigureParams.Sound.YmVolumeMixing);
 
 #if WITH_SDL2
-	EXPORT_SWITCH(SDL2UseLinearScaling, ConfigureParams.Screen.nRenderScaleQuality);
+	EXPORT_SWITCH(SDL2UseGpuScaling, ConfigureParams.Screen.bUseSdlRenderer);
 	EXPORT_SWITCH(SDL2Resizable, ConfigureParams.Screen.bResizable);
 	EXPORT_SWITCH(SDL2UseVSync, ConfigureParams.Screen.bUseVsync);
 #endif
diff --git a/src/gui-osx/en.lproj/SDLMain.xib b/src/gui-osx/en.lproj/SDLMain.xib
index c2801601..d8978d69 100644
--- a/src/gui-osx/en.lproj/SDLMain.xib
+++ b/src/gui-osx/en.lproj/SDLMain.xib
@@ -1203,7 +1203,7 @@ DQ
                                                     <button misplaced="YES" id="uX5-95-dj6">
                                                         <rect key="frame" x="18" y="51" width="145" height="18"/>
                                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                                                        <buttonCell key="cell" type="check" title="Use Linear Scaling" bezelStyle="regularSquare" imagePosition="left" inset="2" id="f9y-RU-qCj">
+                                                        <buttonCell key="cell" type="check" title="Use GPU Scaling" bezelStyle="regularSquare" imagePosition="left" inset="2" id="f9y-RU-qCj">
                                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                             <font key="font" metaFont="system"/>
                                                         </buttonCell>
@@ -2443,7 +2443,7 @@ DQ
                 <outlet property="HDWriteProtection" destination="4668" id="4681"/>
                 <outlet property="MMU_Emulation" destination="aWS-WS-f9G" id="eop-C7-jO5"/>
                 <outlet property="SDL2Resizable" destination="I7I-1M-5Nu" id="AVS-08-eZu"/>
-                <outlet property="SDL2UseLinearScaling" destination="uX5-95-dj6" id="5wO-9c-XNe"/>
+                <outlet property="SDL2UseGpuScaling" destination="uX5-95-dj6" id="5wO-9c-XNe"/>
                 <outlet property="SDL2UseVSync" destination="8G1-GF-0DS" id="qsx-Ol-6G0"/>
                 <outlet property="TTRAMSizeStepper" destination="5kN-DE-Lud" id="5bu-Xe-D9P"/>
                 <outlet property="TTRAMSizeValue" destination="fWm-1J-m56" id="H7t-i0-APJ"/>
diff --git a/src/gui-osx/fr.lproj/SDLMain.xib b/src/gui-osx/fr.lproj/SDLMain.xib
index 0b954dfc..5654be02 100644
--- a/src/gui-osx/fr.lproj/SDLMain.xib
+++ b/src/gui-osx/fr.lproj/SDLMain.xib
@@ -1236,7 +1236,7 @@ DQ
                                                     <button misplaced="YES" id="Sco-Iv-wnc">
                                                         <rect key="frame" x="18" y="52" width="135" height="18"/>
                                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                                                        <buttonCell key="cell" type="check" title="Use Linear Scaling" bezelStyle="regularSquare" imagePosition="left" inset="2" id="TdS-TX-oGj">
+                                                        <buttonCell key="cell" type="check" title="Use GPU Scaling" bezelStyle="regularSquare" imagePosition="left" inset="2" id="TdS-TX-oGj">
                                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                             <font key="font" metaFont="system"/>
                                                         </buttonCell>
@@ -2417,7 +2417,7 @@ DQ
                 <outlet property="HDWriteProtection" destination="4668" id="4681"/>
                 <outlet property="MMU_Emulation" destination="39w-d7-zDS" id="Pzs-It-jZi"/>
                 <outlet property="SDL2Resizable" destination="6Qc-ZR-WJc" id="825-XQ-INr"/>
-                <outlet property="SDL2UseLinearScaling" destination="Sco-Iv-wnc" id="MwD-a7-vKU"/>
+                <outlet property="SDL2UseGpuScaling" destination="Sco-Iv-wnc" id="MwD-a7-vKU"/>
                 <outlet property="SDL2UseVSync" destination="Hti-Yj-SZa" id="hVb-NE-5eH"/>
                 <outlet property="TTRAMSizeStepper" destination="fv9-7a-2KO" id="lxM-bQ-6dz"/>
                 <outlet property="TTRAMSizeValue" destination="4Sq-Pw-zwQ" id="znc-wh-oP9"/>
diff --git a/src/gui-sdl/dlgScreen.c b/src/gui-sdl/dlgScreen.c
index 08b4df0e..2e1900fb 100644
--- a/src/gui-sdl/dlgScreen.c
+++ b/src/gui-sdl/dlgScreen.c
@@ -99,7 +99,7 @@ static SGOBJ monitordlg[] =
 #define DLGSCRN_CAPTURE     29
 #define DLGSCRN_RECANIM     30
 #if WITH_SDL2
-#define DLGSCRN_LINEARSCALE 33
+#define DLGSCRN_GPUSCALE    33
 #define DLGSCRN_RESIZABLE   34
 #define DLGSCRN_VSYNC       35
 #define DLGSCRN_EXIT_WINDOW 36
@@ -166,7 +166,7 @@ static SGOBJ windowdlg[] =
 #if WITH_SDL2
 	{ SGBOX,      0, 0,  1,18, 50,4, NULL },
 	{ SGTEXT,     0, 0, 20,18, 12,1, "SDL2 options" },
-	{ SGCHECKBOX, 0, 0,  4,20, 20,1, "Linear scal_ing" },
+	{ SGCHECKBOX, 0, 0,  8,20, 20,1, "GPU scal_ing" },
 	{ SGCHECKBOX, 0, 0, 23,20, 20,1, "Resi_zable" },
 	{ SGCHECKBOX, 0, 0, 36,20, 11,1, "_VSync" },
 	{ SGBUTTON, SG_DEFAULT, 0, 17,23, 20,1, "Back to main menu" },
@@ -388,10 +388,10 @@ void Dialog_WindowDlg(void)
 		windowdlg[DLGSCRN_RESIZABLE].state |= SG_SELECTED;
 	else
 		windowdlg[DLGSCRN_RESIZABLE].state &= ~SG_SELECTED;
-	if (ConfigureParams.Screen.nRenderScaleQuality)
-		windowdlg[DLGSCRN_LINEARSCALE].state |= SG_SELECTED;
+	if (ConfigureParams.Screen.bUseSdlRenderer)
+		windowdlg[DLGSCRN_GPUSCALE].state |= SG_SELECTED;
 	else
-		windowdlg[DLGSCRN_LINEARSCALE].state &= ~SG_SELECTED;
+		windowdlg[DLGSCRN_GPUSCALE].state &= ~SG_SELECTED;
 
 	if (ConfigureParams.Screen.bUseVsync)
 		windowdlg[DLGSCRN_VSYNC].state |= SG_SELECTED;
@@ -488,7 +488,7 @@ void Dialog_WindowDlg(void)
 
 #if WITH_SDL2
 	ConfigureParams.Screen.bResizable = (windowdlg[DLGSCRN_RESIZABLE].state & SG_SELECTED);
-	ConfigureParams.Screen.nRenderScaleQuality = (windowdlg[DLGSCRN_LINEARSCALE].state & SG_SELECTED) ? 1 : 0;
+	ConfigureParams.Screen.bUseSdlRenderer = (windowdlg[DLGSCRN_GPUSCALE].state & SG_SELECTED);
 	ConfigureParams.Screen.bUseVsync = (windowdlg[DLGSCRN_VSYNC].state & SG_SELECTED);
 #endif
 }
diff --git a/src/includes/configuration.h b/src/includes/configuration.h
index ea0d8c78..ace90653 100644
--- a/src/includes/configuration.h
+++ b/src/includes/configuration.h
@@ -305,7 +305,6 @@ typedef struct
   bool bUseVsync;
   bool bUseSdlRenderer;
   float nZoomFactor;
-  int nRenderScaleQuality;
 #endif
   int nSpec512Threshold;
   int nForceBpp;
diff --git a/src/screen.c b/src/screen.c
index 4ab396de..77f2f55e 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -357,9 +357,6 @@ void Screen_SetTextureScale(int width, int height, int win_width, int win_height
 		char hint[2] = { quality, 0 };
 		prev_quality = quality;
 
-		/* show new value in options */
-		ConfigureParams.Screen.nRenderScaleQuality = quality - '0';
-
 		/* hint needs to be there before texture */
 		SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY, hint, SDL_HINT_OVERRIDE);
 
-- 
2.20.1


--------------69CD54D5487FA4DE087D9377
Content-Type: text/x-patch; charset=UTF-8;
 name="0002-Support-floating-point-zoom-factors-with-SDL2.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-Support-floating-point-zoom-factors-with-SDL2.patch"



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/