diff options
| author | dhewg | 2011-03-13 23:14:42 +0100 | 
|---|---|---|
| committer | dhewg | 2011-03-13 23:30:17 +0100 | 
| commit | df9167c6b33fbfcb259480c14b08be5c32de6fd3 (patch) | |
| tree | acfbb04adf7af3c06e565eb3672edab506217ad3 | |
| parent | c63c2a9e59ab9f9013a5e0e1f6c443352ce4f20f (diff) | |
| download | scummvm-rg350-df9167c6b33fbfcb259480c14b08be5c32de6fd3.tar.gz scummvm-rg350-df9167c6b33fbfcb259480c14b08be5c32de6fd3.tar.bz2 scummvm-rg350-df9167c6b33fbfcb259480c14b08be5c32de6fd3.zip  | |
ANDROID: Add graphics mode for linear filtering
| -rw-r--r-- | backends/platform/android/android.cpp | 1 | ||||
| -rw-r--r-- | backends/platform/android/android.h | 2 | ||||
| -rw-r--r-- | backends/platform/android/gfx.cpp | 21 | ||||
| -rw-r--r-- | backends/platform/android/texture.cpp | 17 | ||||
| -rw-r--r-- | backends/platform/android/texture.h | 3 | 
5 files changed, 32 insertions, 12 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 9f57eb3fb5..606b825a51 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -116,6 +116,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :  	_mouse_keycolor(0),  	_use_mouse_palette(false),  	_fullscreen(false), +	_graphicsMode(0),  	_ar_correction(false),  	_show_mouse(false),  	_show_overlay(false), diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 26245e6a50..8e6d72fad2 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -121,6 +121,7 @@ private:  	bool _show_mouse;  	bool _use_mouse_palette; +	int _graphicsMode;  	bool _fullscreen;  	bool _ar_correction; @@ -175,7 +176,6 @@ public:  	virtual const GraphicsMode *getSupportedGraphicsModes() const;  	virtual int getDefaultGraphicsMode() const; -	bool setGraphicsMode(const char *name);  	virtual bool setGraphicsMode(int mode);  	virtual int getGraphicsMode() const; diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 332442345c..06387e09fe 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -38,7 +38,8 @@ static inline GLfixed xdiv(int numerator, int denominator) {  const OSystem::GraphicsMode *OSystem_Android::getSupportedGraphicsModes() const {  	static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { -		{ "default", "Default", 1 }, +		{ "default", "Default", 0 }, +		{ "filter", "Linear filtering", 1 },  		{ 0, 0, 0 },  	}; @@ -46,23 +47,25 @@ const OSystem::GraphicsMode *OSystem_Android::getSupportedGraphicsModes() const  }  int OSystem_Android::getDefaultGraphicsMode() const { -	return 1; -} - -bool OSystem_Android::setGraphicsMode(const char *mode) { -	ENTER("%s", mode); - -	return true; +	return 0;  }  bool OSystem_Android::setGraphicsMode(int mode) {  	ENTER("%d", mode); +	if (_game_texture) +		_game_texture->setLinearFilter(mode == 1); + +	if (_overlay_texture) +		_overlay_texture->setLinearFilter(mode == 1); + +	_graphicsMode = mode; +  	return true;  }  int OSystem_Android::getGraphicsMode() const { -	return 1; +	return _graphicsMode;  }  #ifdef USE_RGB_COLOR diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index b129b5ed48..bbfd1f0c86 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -83,6 +83,7 @@ GLESBaseTexture::GLESBaseTexture(GLenum glFormat, GLenum glType,  									Graphics::PixelFormat pixelFormat) :  	_glFormat(glFormat),  	_glType(glType), +	_glFilter(GL_NEAREST),  	_texture_name(0),  	_surface(),  	_texture_width(0), @@ -127,8 +128,8 @@ void GLESBaseTexture::initSize() {  	// later (perhaps with multiple TexSubImage2D operations).  	GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name));  	GLCALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); -	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); -	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); +	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glFilter)); +	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _glFilter));  	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));  	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));  	GLCALL(glTexImage2D(GL_TEXTURE_2D, 0, _glFormat, @@ -136,6 +137,18 @@ void GLESBaseTexture::initSize() {  						0, _glFormat, _glType, 0));  } +void GLESBaseTexture::setLinearFilter(bool value) { +	if (value) +		_glFilter = GL_LINEAR; +	else +		_glFilter = GL_NEAREST; + +	GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name)); + +	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glFilter)); +	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _glFilter)); +} +  void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) {  	_surface.w = w;  	_surface.h = h; diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h index 9b41627893..1fe18bfd72 100644 --- a/backends/platform/android/texture.h +++ b/backends/platform/android/texture.h @@ -51,6 +51,8 @@ public:  	void reinit();  	void initSize(); +	void setLinearFilter(bool value); +  	virtual void allocBuffer(GLuint w, GLuint h);  	virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height, @@ -152,6 +154,7 @@ protected:  	GLenum _glFormat;  	GLenum _glType; +	GLint _glFilter;  	GLuint _texture_name;  	Graphics::Surface _surface;  | 
