diff --git a/src/drivers/Qt/ConsoleVideoConf.cpp b/src/drivers/Qt/ConsoleVideoConf.cpp index 682a53a2..f85db198 100644 --- a/src/drivers/Qt/ConsoleVideoConf.cpp +++ b/src/drivers/Qt/ConsoleVideoConf.cpp @@ -179,6 +179,10 @@ void ConsoleVideoConfDialog_t::openGL_linearFilterChanged( int value ) { consoleWindow->viewport_GL->setLinearFilterEnable( opt ); } + if ( consoleWindow->viewport_SDL ) + { + consoleWindow->viewport_SDL->setLinearFilterEnable( opt ); + } } } //---------------------------------------------------- diff --git a/src/drivers/Qt/ConsoleViewerGL.cpp b/src/drivers/Qt/ConsoleViewerGL.cpp index 7ac07279..e4258997 100644 --- a/src/drivers/Qt/ConsoleViewerGL.cpp +++ b/src/drivers/Qt/ConsoleViewerGL.cpp @@ -40,6 +40,8 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent) memset( localBuf, 0, localBufSize ); } + linearFilter = false; + if ( g_config ) { int opt; @@ -133,9 +135,12 @@ void ConsoleViewGL_t::resizeGL(int w, int h) void ConsoleViewGL_t::setLinearFilterEnable( bool ena ) { - linearFilter = ena; + if ( linearFilter != ena ) + { + linearFilter = ena; - buildTextures(); + buildTextures(); + } } void ConsoleViewGL_t::transfer2LocalBuffer(void) diff --git a/src/drivers/Qt/ConsoleViewerSDL.cpp b/src/drivers/Qt/ConsoleViewerSDL.cpp index 4f96346e..139d5812 100644 --- a/src/drivers/Qt/ConsoleViewerSDL.cpp +++ b/src/drivers/Qt/ConsoleViewerSDL.cpp @@ -7,6 +7,7 @@ #include #include "Qt/nes_shm.h" +#include "Qt/fceuWrapper.h" #include "Qt/ConsoleViewerSDL.h" extern unsigned int gui_draw_area_width; @@ -46,6 +47,15 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent) memset( localBuf, 0, localBufSize ); } + linearFilter = false; + + if ( g_config ) + { + int opt; + g_config->getOption("SDL.OpenGLip", &opt ); + + linearFilter = (opt) ? true : false; + } } ConsoleViewSDL_t::~ConsoleViewSDL_t(void) @@ -56,6 +66,16 @@ ConsoleViewSDL_t::~ConsoleViewSDL_t(void) } } +void ConsoleViewSDL_t::setLinearFilterEnable( bool ena ) +{ + if ( ena != linearFilter ) + { + linearFilter = ena; + + reset(); + } +} + void ConsoleViewSDL_t::transfer2LocalBuffer(void) { memcpy( localBuf, nes_shm->pixbuf, localBufSize ); @@ -65,6 +85,15 @@ int ConsoleViewSDL_t::init(void) { WId windowHandle; + if ( linearFilter ) + { + SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ); + } + else + { + SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "0" ); + } + if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) { printf("[SDL] Failed to initialize video subsystem.\n"); diff --git a/src/drivers/Qt/ConsoleViewerSDL.h b/src/drivers/Qt/ConsoleViewerSDL.h index 45de62e7..a7ccbd83 100644 --- a/src/drivers/Qt/ConsoleViewerSDL.h +++ b/src/drivers/Qt/ConsoleViewerSDL.h @@ -23,6 +23,8 @@ class ConsoleViewSDL_t : public QWidget void transfer2LocalBuffer(void); + void setLinearFilterEnable( bool ena ); + protected: //void paintEvent(QPaintEvent *event); @@ -39,6 +41,7 @@ class ConsoleViewSDL_t : public QWidget int sdlRendH; bool vsyncEnabled; + bool linearFilter; uint32_t *localBuf; uint32_t localBufSize;