Merge pull request #194 from mjbudd77/master
Added video pixel linear filtering capability for SDL video backend option.
This commit is contained in:
commit
5f4af397d0
|
@ -179,6 +179,10 @@ void ConsoleVideoConfDialog_t::openGL_linearFilterChanged( int value )
|
||||||
{
|
{
|
||||||
consoleWindow->viewport_GL->setLinearFilterEnable( opt );
|
consoleWindow->viewport_GL->setLinearFilterEnable( opt );
|
||||||
}
|
}
|
||||||
|
if ( consoleWindow->viewport_SDL )
|
||||||
|
{
|
||||||
|
consoleWindow->viewport_SDL->setLinearFilterEnable( opt );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
|
@ -40,6 +40,8 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
||||||
memset( localBuf, 0, localBufSize );
|
memset( localBuf, 0, localBufSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
linearFilter = false;
|
||||||
|
|
||||||
if ( g_config )
|
if ( g_config )
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
|
@ -132,11 +134,14 @@ void ConsoleViewGL_t::resizeGL(int w, int h)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleViewGL_t::setLinearFilterEnable( bool ena )
|
void ConsoleViewGL_t::setLinearFilterEnable( bool ena )
|
||||||
|
{
|
||||||
|
if ( linearFilter != ena )
|
||||||
{
|
{
|
||||||
linearFilter = ena;
|
linearFilter = ena;
|
||||||
|
|
||||||
buildTextures();
|
buildTextures();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ConsoleViewGL_t::transfer2LocalBuffer(void)
|
void ConsoleViewGL_t::transfer2LocalBuffer(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "Qt/nes_shm.h"
|
#include "Qt/nes_shm.h"
|
||||||
|
#include "Qt/fceuWrapper.h"
|
||||||
#include "Qt/ConsoleViewerSDL.h"
|
#include "Qt/ConsoleViewerSDL.h"
|
||||||
|
|
||||||
extern unsigned int gui_draw_area_width;
|
extern unsigned int gui_draw_area_width;
|
||||||
|
@ -46,6 +47,15 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
||||||
memset( localBuf, 0, localBufSize );
|
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)
|
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)
|
void ConsoleViewSDL_t::transfer2LocalBuffer(void)
|
||||||
{
|
{
|
||||||
memcpy( localBuf, nes_shm->pixbuf, localBufSize );
|
memcpy( localBuf, nes_shm->pixbuf, localBufSize );
|
||||||
|
@ -65,6 +85,15 @@ int ConsoleViewSDL_t::init(void)
|
||||||
{
|
{
|
||||||
WId windowHandle;
|
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)
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
|
||||||
{
|
{
|
||||||
printf("[SDL] Failed to initialize video subsystem.\n");
|
printf("[SDL] Failed to initialize video subsystem.\n");
|
||||||
|
|
|
@ -23,6 +23,8 @@ class ConsoleViewSDL_t : public QWidget
|
||||||
|
|
||||||
void transfer2LocalBuffer(void);
|
void transfer2LocalBuffer(void);
|
||||||
|
|
||||||
|
void setLinearFilterEnable( bool ena );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//void paintEvent(QPaintEvent *event);
|
//void paintEvent(QPaintEvent *event);
|
||||||
|
@ -39,6 +41,7 @@ class ConsoleViewSDL_t : public QWidget
|
||||||
int sdlRendH;
|
int sdlRendH;
|
||||||
|
|
||||||
bool vsyncEnabled;
|
bool vsyncEnabled;
|
||||||
|
bool linearFilter;
|
||||||
|
|
||||||
uint32_t *localBuf;
|
uint32_t *localBuf;
|
||||||
uint32_t localBufSize;
|
uint32_t localBufSize;
|
||||||
|
|
Loading…
Reference in New Issue