[Scummvm-cvs-logs] scummvm master -> ce9796baa3185417af53969e1258350648c2fc5a

dhewg dhewg at wiibrew.org
Thu Mar 3 21:30:37 CET 2011


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1e3c96b3ef ANDROID: Formatting/whitespaces
a7a7542d1d ANDROID: Remove an indirection when pausing
3df060b656 ANDROID: Rename member vars according to our style
7157454e9b ANDROID: Implement surface resizes
ce9796baa3 ANDROID: Don't wipe paletted textures on reinit


Commit: 1e3c96b3efaea537dfe82b1d535d1d46cc82a8a0
    https://github.com/scummvm/scummvm/commit/1e3c96b3efaea537dfe82b1d535d1d46cc82a8a0
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-03T11:46:49-08:00

Commit Message:
ANDROID: Formatting/whitespaces

Changed paths:
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/android/asset-archive.cpp
    backends/platform/android/jni.cpp
    backends/platform/android/jni.h
    backends/platform/android/org/inodes/gus/scummvm/Unpacker.java
    backends/platform/android/texture.cpp



diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 491e5fb..2d396f2 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -55,7 +55,8 @@ extern "C" {
 								 expr, file, line);
 	}
 
-	void __assert2(const char *file, int line, const char *func, const char *expr) {
+	void __assert2(const char *file, int line, const char *func,
+					const char *expr) {
 		__android_log_assert(expr, android_log_tag,
 								"Assertion failure: '%s' in %s:%d (%s)",
 								 expr, file, line, func);
@@ -152,7 +153,7 @@ void *OSystem_Android::timerThreadFunc(void *arg) {
 			sem_wait(&JNI::pause_sem);
 			LOGD("timer thread woke up");
 		}
-			
+
 		timer->handler();
 		nanosleep(&tv, 0);
 	}
@@ -199,7 +200,7 @@ void *OSystem_Android::audioThreadFunc(void *arg) {
 			sem_wait(&JNI::pause_sem);
 			LOGD("audio thread woke up");
 		}
-			
+
 		buf = (byte *)env->GetPrimitiveArrayCritical(bufa, 0);
 		assert(buf);
 
@@ -650,7 +651,8 @@ void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,
 	JNI::addSysArchivesToSearchSet(s, priority);
 }
 
-void OSystem_Android::logMessage(LogMessageType::Type type, const char *message) {
+void OSystem_Android::logMessage(LogMessageType::Type type,
+									const char *message) {
 	switch (type) {
 	case LogMessageType::kDebug:
 		__android_log_write(ANDROID_LOG_DEBUG, android_log_tag, message);
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index aa6016e..5db10fb 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -177,7 +177,8 @@ protected:
 	virtual void grabPalette(byte *colors, uint start, uint num);
 
 public:
-	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,
+									int w, int h);
 	virtual void updateScreen();
 	virtual Graphics::Surface *lockScreen();
 	virtual void unlockScreen();
@@ -190,7 +191,8 @@ public:
 	virtual void hideOverlay();
 	virtual void clearOverlay();
 	virtual void grabOverlay(OverlayColor *buf, int pitch);
-	virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+	virtual void copyRectToOverlay(const OverlayColor *buf, int pitch,
+									int x, int y, int w, int h);
 	virtual int16 getOverlayHeight();
 	virtual int16 getOverlayWidth();
 
@@ -214,7 +216,10 @@ public:
 	virtual bool showMouse(bool visible);
 
 	virtual void warpMouse(int x, int y);
-	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
+	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
+								int hotspotY, uint32 keycolor,
+								int cursorTargetScale,
+								const Graphics::PixelFormat *format);
 	virtual void setCursorPalette(const byte *colors, uint start, uint num);
 	virtual void disableCursorPalette(bool disable);
 
@@ -240,7 +245,8 @@ public:
 	virtual Common::TimerManager *getTimerManager();
 	virtual FilesystemFactory *getFilesystemFactory();
 	virtual void logMessage(LogMessageType::Type type, const char *message);
-	virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
+	virtual void addSysArchivesToSearchSet(Common::SearchSet &s,
+											int priority = 0);
 };
 
 #endif
diff --git a/backends/platform/android/asset-archive.cpp b/backends/platform/android/asset-archive.cpp
index eb25308..26b1a6a 100644
--- a/backends/platform/android/asset-archive.cpp
+++ b/backends/platform/android/asset-archive.cpp
@@ -99,7 +99,7 @@ JavaInputStream::JavaInputStream(JNIEnv *env, jobject is) :
 {
 	_input_stream = env->NewGlobalRef(is);
 	_buflen = 8192;
-	_buf = static_cast<jbyteArray>(env->NewGlobalRef(env->NewByteArray(_buflen)));
+	_buf = (jbyteArray)env->NewGlobalRef(env->NewByteArray(_buflen));
 
 	jclass cls = env->GetObjectClass(_input_stream);
 	MID_mark = env->GetMethodID(cls, "mark", "(I)V");
@@ -142,7 +142,7 @@ uint32 JavaInputStream::read(void *dataPtr, uint32 dataSize) {
 
 	if (_buflen < jint(dataSize)) {
 		_buflen = dataSize;
-	
+
 		env->DeleteGlobalRef(_buf);
 		_buf = static_cast<jbyteArray>(env->NewGlobalRef(env->NewByteArray(_buflen)));
 	}
@@ -304,7 +304,8 @@ AssetFdReadStream::AssetFdReadStream(JNIEnv *env, jobject assetfd) :
 	_declared_len = env->CallLongMethod(_assetfd, MID_getDeclaredLength);
 
 	jmethodID MID_getFileDescriptor =
-		env->GetMethodID(cls, "getFileDescriptor", "()Ljava/io/FileDescriptor;");
+		env->GetMethodID(cls, "getFileDescriptor",
+							"()Ljava/io/FileDescriptor;");
 	assert(MID_getFileDescriptor);
 	jobject javafd = env->CallObjectMethod(_assetfd, MID_getFileDescriptor);
 	assert(javafd);
@@ -376,8 +377,8 @@ AndroidAssetArchive::AndroidAssetArchive(jobject am) {
 								"(Ljava/lang/String;I)Ljava/io/InputStream;");
 	assert(MID_open);
 
-	MID_openFd = env->GetMethodID(cls, "openFd",
-									"(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;");
+	MID_openFd = env->GetMethodID(cls, "openFd", "(Ljava/lang/String;)"
+								"Landroid/content/res/AssetFileDescriptor;");
 	assert(MID_openFd);
 
 	MID_list = env->GetMethodID(cls, "list",
@@ -421,7 +422,8 @@ int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) {
 		dirlist.pop_back();
 
 		jstring jpath = env->NewStringUTF(dir.c_str());
-		jobjectArray jpathlist = static_cast<jobjectArray>(env->CallObjectMethod(_am, MID_list, jpath));
+		jobjectArray jpathlist =
+			(jobjectArray)env->CallObjectMethod(_am, MID_list, jpath);
 
 		if (env->ExceptionCheck()) {
 			warning("Error while calling AssetManager->list(%s). Ignoring.",
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index 1759730..e1acabd 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -90,9 +90,9 @@ const JNINativeMethod JNI::_natives[] = {
 	{ "destroy", "()V",
 		(void *)JNI::destroy },
 	{ "setSurface", "(II)V",
-	 	(void *)JNI::setSurface },
+		(void *)JNI::setSurface },
 	{ "main", "([Ljava/lang/String;)I",
-	 	(void *)JNI::main },
+		(void *)JNI::main },
 	{ "pushEvent", "(Lorg/inodes/gus/scummvm/Event;)V",
 		(void *)JNI::pushEvent },
 	{ "enableZoning", "(Z)V",
diff --git a/backends/platform/android/jni.h b/backends/platform/android/jni.h
index 569a3dd..8468813 100644
--- a/backends/platform/android/jni.h
+++ b/backends/platform/android/jni.h
@@ -149,7 +149,8 @@ inline bool JNI::swapBuffers() {
 }
 
 inline int JNI::writeAudio(JNIEnv *env, jbyteArray &data, int offset, int size) {
-	return env->CallIntMethod(_jobj_audio_track, _MID_AudioTrack_write, data, offset, size);
+	return env->CallIntMethod(_jobj_audio_track, _MID_AudioTrack_write, data,
+								offset, size);
 }
 
 #endif
diff --git a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java
index 8811b1f..c4b2ad7 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java
@@ -370,3 +370,4 @@ public class Unpacker extends Activity {
 		}
 	}
 }
+
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index ea8a89d..cb12d26 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -332,7 +332,8 @@ void GLESPaletteTexture::uploadTexture() const {
 									0, texture_size, _texture));
 }
 
-void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
+void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
+										GLshort h) {
 	if (_all_dirty) {
 		GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name));
 		GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,


Commit: a7a7542d1de3f6bb8d076b04cf63a761f01472e1
    https://github.com/scummvm/scummvm/commit/a7a7542d1de3f6bb8d076b04cf63a761f01472e1
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-03T11:47:27-08:00

Commit Message:
ANDROID: Remove an indirection when pausing

Changed paths:
    backends/platform/android/android.cpp
    backends/platform/android/jni.cpp
    backends/platform/android/jni.h
    backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
    backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java



diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 2d396f2..35a6421 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -196,6 +196,11 @@ void *OSystem_Android::audioThreadFunc(void *arg) {
 
 	while (!system->_audio_thread_exit) {
 		if (JNI::pause) {
+			JNI::setAudioStop();
+
+			paused = true;
+			silence_count = 33;
+
 			LOGD("audio thread going to sleep");
 			sem_wait(&JNI::pause_sem);
 			LOGD("audio thread woke up");
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index e1acabd..73b7439 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -97,8 +97,8 @@ const JNINativeMethod JNI::_natives[] = {
 		(void *)JNI::pushEvent },
 	{ "enableZoning", "(Z)V",
 		(void *)JNI::enableZoning },
-	{ "pauseEngine", "(Z)V",
-		(void *)JNI::pauseEngine }
+	{ "setPause", "(Z)V",
+		(void *)JNI::setPause }
 };
 
 JNI::JNI() {
@@ -625,7 +625,7 @@ void JNI::enableZoning(JNIEnv *env, jobject self, jboolean enable) {
 	_system->enableZoning(enable);
 }
 
-void JNI::pauseEngine(JNIEnv *env, jobject self, jboolean value) {
+void JNI::setPause(JNIEnv *env, jobject self, jboolean value) {
 	if (!_system)
 		return;
 
diff --git a/backends/platform/android/jni.h b/backends/platform/android/jni.h
index 8468813..1469386 100644
--- a/backends/platform/android/jni.h
+++ b/backends/platform/android/jni.h
@@ -134,7 +134,7 @@ private:
 	static void pushEvent(JNIEnv *env, jobject self, jobject java_event);
 	static void enableZoning(JNIEnv *env, jobject self, jboolean enable);
 
-	static void pauseEngine(JNIEnv *env, jobject self, jboolean pause);
+	static void setPause(JNIEnv *env, jobject self, jboolean value);
 };
 
 inline bool JNI::haveSurface() {
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
index ffb0109..20e0382 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
@@ -44,9 +44,9 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 	final private native void destroy();
 	final private native void setSurface(int width, int height);
 	final private native int main(String[] args);
-	final private native void pauseEngine(boolean pause);
 
-	// Set scummvm config options
+	// pause the engine and all native threads
+	final public native void setPause(boolean pause);
 	final public native void enableZoning(boolean enable);
 	// Feed an event to ScummVM.  Safe to call from other threads.
 	final public native void pushEvent(Event e);
@@ -135,16 +135,6 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 		System.exit(res);
 	}
 
-	public void pause(boolean pause) {
-		if (audio_track != null && !pause)
-			audio_track.play();
-
-		pauseEngine(pause);
-
-		if (audio_track != null && pause)
-			audio_track.stop();
-	}
-
 	final private void initEGL() throws Exception {
 		egl = (EGL10)EGLContext.getEGL();
 		eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
index 22ccaf0..921e248 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
@@ -175,7 +175,7 @@ public class ScummVMActivity extends Activity {
 		super.onResume();
 
 		if (scummvm != null)
-			scummvm.pause(false);
+			scummvm.setPause(false);
 	}
 
 	@Override
@@ -185,7 +185,7 @@ public class ScummVMActivity extends Activity {
 		super.onPause();
 
 		if (scummvm != null)
-			scummvm.pause(true);
+			scummvm.setPause(true);
 	}
 
 	@Override


Commit: 3df060b6567d37a1a3bee314a686bb2435e482f6
    https://github.com/scummvm/scummvm/commit/3df060b6567d37a1a3bee314a686bb2435e482f6
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-03T11:47:32-08:00

Commit Message:
ANDROID: Rename member vars according to our style

Changed paths:
    backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
    backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
    backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java



diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
index 20e0382..f263b89 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
@@ -21,24 +21,24 @@ import java.util.LinkedHashMap;
 
 public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 	final protected static String LOG_TAG = "ScummVM";
-	final private AssetManager asset_manager;
-	final private Object sem_surface;
+	final private AssetManager _asset_manager;
+	final private Object _sem_surface;
 
-	private EGL10 egl;
-	private EGLDisplay eglDisplay = EGL10.EGL_NO_DISPLAY;
-	private EGLConfig eglConfig;
-	private EGLContext eglContext = EGL10.EGL_NO_CONTEXT;
-	private EGLSurface eglSurface = EGL10.EGL_NO_SURFACE;
+	private EGL10 _egl;
+	private EGLDisplay _egl_display = EGL10.EGL_NO_DISPLAY;
+	private EGLConfig _egl_config;
+	private EGLContext _egl_context = EGL10.EGL_NO_CONTEXT;
+	private EGLSurface _egl_surface = EGL10.EGL_NO_SURFACE;
 
-	private SurfaceHolder surface_holder;
-	private AudioTrack audio_track;
-	private int sample_rate = 0;
-	private int buffer_size = 0;
+	private SurfaceHolder _surface_holder;
+	private AudioTrack _audio_track;
+	private int _sample_rate = 0;
+	private int _buffer_size = 0;
 
-	private String[] args;
+	private String[] _args;
 
-	final private native void create(AssetManager asset_manager,
-										EGL10 egl, EGLDisplay eglDisplay,
+	final private native void create(AssetManager _asset_manager,
+										EGL10 egl, EGLDisplay egl_display,
 										AudioTrack audio_track,
 										int sample_rate, int buffer_size);
 	final private native void destroy();
@@ -59,8 +59,8 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 	abstract protected String[] getSysArchives();
 
 	public ScummVM(AssetManager asset_manager, SurfaceHolder holder) {
-		this.asset_manager = asset_manager;
-		sem_surface = new Object();
+		_asset_manager = asset_manager;
+		_sem_surface = new Object();
 
 		holder.addCallback(this);
 	}
@@ -78,9 +78,9 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 		Log.d(LOG_TAG, String.format("surfaceChanged: %dx%d (%d)",
 										width, height, format));
 
-		synchronized(sem_surface) {
-			surface_holder = holder;
-			sem_surface.notifyAll();
+		synchronized(_sem_surface) {
+			_surface_holder = holder;
+			_sem_surface.notifyAll();
 		}
 
 		// store values for the native code
@@ -91,9 +91,9 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 	final public void surfaceDestroyed(SurfaceHolder holder) {
 		Log.d(LOG_TAG, "surfaceDestroyed");
 
-		synchronized(sem_surface) {
-			surface_holder = null;
-			sem_surface.notifyAll();
+		synchronized(_sem_surface) {
+			_surface_holder = null;
+			_sem_surface.notifyAll();
 		}
 
 		// clear values for the native code
@@ -101,7 +101,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 	}
 
 	final public void setArgs(String[] args) {
-		this.args = args;
+		_args = args;
 	}
 
 	final public void run() {
@@ -110,9 +110,9 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 			initEGL();
 
 			// wait for the surfaceChanged callback
-			synchronized(sem_surface) {
-				while (surface_holder == null)
-					sem_surface.wait();
+			synchronized(_sem_surface) {
+				while (_surface_holder == null)
+					_sem_surface.wait();
 			}
 		} catch (Exception e) {
 			deinitEGL();
@@ -121,10 +121,10 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 			throw new RuntimeException("Error preparing the ScummVM thread", e);
 		}
 
-		create(asset_manager, egl, eglDisplay,
-				audio_track, sample_rate, buffer_size);
+		create(_asset_manager, _egl, _egl_display,
+				_audio_track, _sample_rate, _buffer_size);
 
-		int res = main(args);
+		int res = main(_args);
 
 		destroy();
 
@@ -136,14 +136,14 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 	}
 
 	final private void initEGL() throws Exception {
-		egl = (EGL10)EGLContext.getEGL();
-		eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+		_egl = (EGL10)EGLContext.getEGL();
+		_egl_display = _egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
 
 		int[] version = new int[2];
-		egl.eglInitialize(eglDisplay, version);
+		_egl.eglInitialize(_egl_display, version);
 
 		int[] num_config = new int[1];
-		egl.eglChooseConfig(eglDisplay, configSpec, null, 0, num_config);
+		_egl.eglChooseConfig(_egl_display, configSpec, null, 0, num_config);
 
 		final int numConfigs = num_config[0];
 
@@ -151,8 +151,8 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 			throw new IllegalArgumentException("No configs match configSpec");
 
 		EGLConfig[] configs = new EGLConfig[numConfigs];
-		egl.eglChooseConfig(eglDisplay, configSpec, configs, numConfigs,
-							num_config);
+		_egl.eglChooseConfig(_egl_display, configSpec, configs, numConfigs,
+								num_config);
 
 		if (false) {
 			Log.d(LOG_TAG, String.format("Found %d EGL configurations.",
@@ -163,119 +163,120 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 
 		// Android's eglChooseConfig is busted in several versions and
 		// devices so we have to filter/rank the configs again ourselves.
-		eglConfig = chooseEglConfig(configs);
+		_egl_config = chooseEglConfig(configs);
 
 		if (false) {
 			Log.d(LOG_TAG, String.format("Chose from %d EGL configs",
 											numConfigs));
-			dumpEglConfig(eglConfig);
+			dumpEglConfig(_egl_config);
 		}
 
-		eglContext = egl.eglCreateContext(eglDisplay, eglConfig,
+		_egl_context = _egl.eglCreateContext(_egl_display, _egl_config,
 											EGL10.EGL_NO_CONTEXT, null);
 
-		if (eglContext == EGL10.EGL_NO_CONTEXT)
+		if (_egl_context == EGL10.EGL_NO_CONTEXT)
 			throw new Exception(String.format("Failed to create context: 0x%x",
-												egl.eglGetError()));
+												_egl.eglGetError()));
 	}
 
 	// Callback from C++ peer instance
 	final protected EGLSurface initSurface() throws Exception {
-		eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig,
-												surface_holder, null);
+		_egl_surface = _egl.eglCreateWindowSurface(_egl_display, _egl_config,
+													_surface_holder, null);
 
-		if (eglSurface == EGL10.EGL_NO_SURFACE)
+		if (_egl_surface == EGL10.EGL_NO_SURFACE)
 			throw new Exception(String.format(
-					"eglCreateWindowSurface failed: 0x%x", egl.eglGetError()));
+					"eglCreateWindowSurface failed: 0x%x", _egl.eglGetError()));
 
-		egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
+		_egl.eglMakeCurrent(_egl_display, _egl_surface, _egl_surface,
+							_egl_context);
 
-		GL10 gl = (GL10)eglContext.getGL();
+		GL10 gl = (GL10)_egl_context.getGL();
 
 		Log.i(LOG_TAG, String.format("Using EGL %s (%s); GL %s/%s (%s)",
-						egl.eglQueryString(eglDisplay, EGL10.EGL_VERSION),
-						egl.eglQueryString(eglDisplay, EGL10.EGL_VENDOR),
+						_egl.eglQueryString(_egl_display, EGL10.EGL_VERSION),
+						_egl.eglQueryString(_egl_display, EGL10.EGL_VENDOR),
 						gl.glGetString(GL10.GL_VERSION),
 						gl.glGetString(GL10.GL_RENDERER),
 						gl.glGetString(GL10.GL_VENDOR)));
 
-		return eglSurface;
+		return _egl_surface;
 	}
 
 	// Callback from C++ peer instance
 	final protected void deinitSurface() {
-		if (eglDisplay != EGL10.EGL_NO_DISPLAY) {
-			egl.eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE,
+		if (_egl_display != EGL10.EGL_NO_DISPLAY) {
+			_egl.eglMakeCurrent(_egl_display, EGL10.EGL_NO_SURFACE,
 								EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
 
-			if (eglSurface != EGL10.EGL_NO_SURFACE)
-				egl.eglDestroySurface(eglDisplay, eglSurface);
+			if (_egl_surface != EGL10.EGL_NO_SURFACE)
+				_egl.eglDestroySurface(_egl_display, _egl_surface);
 		}
 
-		eglSurface = EGL10.EGL_NO_SURFACE;
+		_egl_surface = EGL10.EGL_NO_SURFACE;
 	}
 
 	final private void deinitEGL() {
-		if (eglDisplay != EGL10.EGL_NO_DISPLAY) {
-			egl.eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE,
+		if (_egl_display != EGL10.EGL_NO_DISPLAY) {
+			_egl.eglMakeCurrent(_egl_display, EGL10.EGL_NO_SURFACE,
 								EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
 
-			if (eglSurface != EGL10.EGL_NO_SURFACE)
-				egl.eglDestroySurface(eglDisplay, eglSurface);
+			if (_egl_surface != EGL10.EGL_NO_SURFACE)
+				_egl.eglDestroySurface(_egl_display, _egl_surface);
 
-			if (eglContext != EGL10.EGL_NO_CONTEXT)
-				egl.eglDestroyContext(eglDisplay, eglContext);
+			if (_egl_context != EGL10.EGL_NO_CONTEXT)
+				_egl.eglDestroyContext(_egl_display, _egl_context);
 
-			egl.eglTerminate(eglDisplay);
+			_egl.eglTerminate(_egl_display);
 		}
 
-		eglSurface = EGL10.EGL_NO_SURFACE;
-		eglContext = EGL10.EGL_NO_CONTEXT;
-		eglConfig = null;
-		eglDisplay = EGL10.EGL_NO_DISPLAY;
-		egl = null;
+		_egl_surface = EGL10.EGL_NO_SURFACE;
+		_egl_context = EGL10.EGL_NO_CONTEXT;
+		_egl_config = null;
+		_egl_display = EGL10.EGL_NO_DISPLAY;
+		_egl = null;
 	}
 
 	final private void initAudio() throws Exception {
-		sample_rate = AudioTrack.getNativeOutputSampleRate(
+		_sample_rate = AudioTrack.getNativeOutputSampleRate(
 									AudioManager.STREAM_MUSIC);
-		buffer_size = AudioTrack.getMinBufferSize(sample_rate,
+		_buffer_size = AudioTrack.getMinBufferSize(_sample_rate,
 									AudioFormat.CHANNEL_CONFIGURATION_STEREO,
 									AudioFormat.ENCODING_PCM_16BIT);
 
 		// ~100ms
-		int buffer_size_want = (sample_rate * 2 * 2 / 10) & ~1023;
+		int buffer_size_want = (_sample_rate * 2 * 2 / 10) & ~1023;
 
-		if (buffer_size < buffer_size_want) {
+		if (_buffer_size < buffer_size_want) {
 			Log.w(LOG_TAG, String.format(
-				"adjusting audio buffer size (was: %d)", buffer_size));
+				"adjusting audio buffer size (was: %d)", _buffer_size));
 
-			buffer_size = buffer_size_want;
+			_buffer_size = buffer_size_want;
 		}
 
 		Log.i(LOG_TAG, String.format("Using %d bytes buffer for %dHz audio",
-										buffer_size, sample_rate));
+										_buffer_size, _sample_rate));
 
-		audio_track = new AudioTrack(AudioManager.STREAM_MUSIC,
-									sample_rate,
+		_audio_track = new AudioTrack(AudioManager.STREAM_MUSIC,
+									_sample_rate,
 									AudioFormat.CHANNEL_CONFIGURATION_STEREO,
 									AudioFormat.ENCODING_PCM_16BIT,
-									buffer_size,
+									_buffer_size,
 									AudioTrack.MODE_STREAM);
 
-		if (audio_track.getState() != AudioTrack.STATE_INITIALIZED)
+		if (_audio_track.getState() != AudioTrack.STATE_INITIALIZED)
 			throw new Exception(
 				String.format("Error initialising AudioTrack: %d",
-								audio_track.getState()));
+								_audio_track.getState()));
 	}
 
 	final private void deinitAudio() {
-		if (audio_track != null)
-			audio_track.stop();
+		if (_audio_track != null)
+			_audio_track.stop();
 
-		audio_track = null;
-		buffer_size = 0;
-		sample_rate = 0;
+		_audio_track = null;
+		_buffer_size = 0;
+		_sample_rate = 0;
 	}
 
 	static final int configSpec[] = {
@@ -325,7 +326,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 		int[] value = new int[1];
 
 		for (Map.Entry<String, Integer> entry : attribs.entrySet()) {
-			egl.eglGetConfigAttrib(eglDisplay, config,
+			_egl.eglGetConfigAttrib(_egl_display, config,
 									entry.getValue(), value);
 
 			if (value[0] == EGL10.EGL_NONE)
@@ -344,14 +345,14 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 			EGLConfig config = configs[i];
 			int score = 10000;
 
-			egl.eglGetConfigAttrib(eglDisplay, config,
+			_egl.eglGetConfigAttrib(_egl_display, config,
 									EGL10.EGL_SURFACE_TYPE, value);
 
 			// must have
 			if ((value[0] & EGL10.EGL_WINDOW_BIT) == 0)
 				continue;
 
-			egl.eglGetConfigAttrib(eglDisplay, config,
+			_egl.eglGetConfigAttrib(_egl_display, config,
 									EGL10.EGL_CONFIG_CAVEAT, value);
 
 			if (value[0] != EGL10.EGL_NONE)
@@ -365,7 +366,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 									};
 
 			for (int component : colorBits) {
-				egl.eglGetConfigAttrib(eglDisplay, config, component, value);
+				_egl.eglGetConfigAttrib(_egl_display, config, component, value);
 
 				// boost if >5 bits accuracy
 				if (value[0] >= 5)
@@ -375,7 +376,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 				score -= value[0];
 			}
 
-			egl.eglGetConfigAttrib(eglDisplay, config,
+			_egl.eglGetConfigAttrib(_egl_display, config,
 									EGL10.EGL_DEPTH_SIZE, value);
 
 			// penalize for wasted bits
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
index 921e248..8cb3d80 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
@@ -96,8 +96,8 @@ public class ScummVMActivity extends Activity {
 
 	}
 
-	private MyScummVM scummvm;
-	private Thread scummvm_thread;
+	private MyScummVM _scummvm;
+	private Thread _scummvm_thread;
 
 	@Override
 	public void onCreate(Bundle savedInstanceState) {
@@ -147,9 +147,9 @@ public class ScummVMActivity extends Activity {
 		getFilesDir().mkdirs();
 
 		// Start ScummVM
-		scummvm = new MyScummVM(main_surface.getHolder());
+		_scummvm = new MyScummVM(main_surface.getHolder());
 
-		scummvm.setArgs(new String[] {
+		_scummvm.setArgs(new String[] {
 			"ScummVM",
 			"--config=" + getFileStreamPath("scummvmrc").getPath(),
 			"--path=" + Environment.getExternalStorageDirectory().getPath(),
@@ -157,8 +157,8 @@ public class ScummVMActivity extends Activity {
 			"--savepath=" + getDir("saves", 0).getPath()
 		});
 
-		scummvm_thread = new Thread(scummvm, "ScummVM");
-		scummvm_thread.start();
+		_scummvm_thread = new Thread(_scummvm, "ScummVM");
+		_scummvm_thread.start();
 	}
 
 	@Override
@@ -174,8 +174,8 @@ public class ScummVMActivity extends Activity {
 
 		super.onResume();
 
-		if (scummvm != null)
-			scummvm.setPause(false);
+		if (_scummvm != null)
+			_scummvm.setPause(false);
 	}
 
 	@Override
@@ -184,8 +184,8 @@ public class ScummVMActivity extends Activity {
 
 		super.onPause();
 
-		if (scummvm != null)
-			scummvm.setPause(true);
+		if (_scummvm != null)
+			_scummvm.setPause(true);
 	}
 
 	@Override
@@ -201,17 +201,17 @@ public class ScummVMActivity extends Activity {
 
 		super.onDestroy();
 
-		if (scummvm != null) {
-			scummvm.pushEvent(new Event(Event.EVENT_QUIT));
+		if (_scummvm != null) {
+			_scummvm.pushEvent(new Event(Event.EVENT_QUIT));
 
 			try {
 				// 1s timeout
-				scummvm_thread.join(1000);
+				_scummvm_thread.join(1000);
 			} catch (InterruptedException e) {
 				Log.i(ScummVM.LOG_TAG, "Error while joining ScummVM thread", e);
 			}
 
-			scummvm = null;
+			_scummvm = null;
 		}
 	}
 
@@ -265,7 +265,7 @@ public class ScummVMActivity extends Activity {
 
 			if (kevent.getAction() == KeyEvent.ACTION_UP) {
 				if (!timeout_fired)
-					scummvm.pushEvent(new Event(Event.EVENT_MAINMENU));
+					_scummvm.pushEvent(new Event(Event.EVENT_MAINMENU));
 
 				return true;
 			}
@@ -332,7 +332,7 @@ public class ScummVMActivity extends Activity {
 				break;
 			}
 
-			scummvm.pushEvent(e);
+			_scummvm.pushEvent(e);
 
 			return true;
 		}
@@ -404,13 +404,13 @@ public class ScummVMActivity extends Activity {
 		if (kevent.getAction() == KeyEvent.ACTION_MULTIPLE) {
 			for (int i = 0; i <= kevent.getRepeatCount(); i++) {
 				e.type = Event.EVENT_KEYDOWN;
-				scummvm.pushEvent(e);
+				_scummvm.pushEvent(e);
 
 				e.type = Event.EVENT_KEYUP;
-				scummvm.pushEvent(e);
+				_scummvm.pushEvent(e);
 			}
 		} else {
-			scummvm.pushEvent(e);
+			_scummvm.pushEvent(e);
 		}
 
 		return true;
@@ -448,7 +448,7 @@ public class ScummVMActivity extends Activity {
 			(int)(event.getY() * event.getYPrecision()) * TRACKBALL_SCALE;
 		e.mouse_relative = true;
 
-		scummvm.pushEvent(e);
+		_scummvm.pushEvent(e);
 
 		return true;
 	}
@@ -465,7 +465,7 @@ public class ScummVMActivity extends Activity {
 		e.mouse_y = (int)event.getY();
 		e.mouse_relative = false;
 
-		scummvm.pushEvent(e);
+		_scummvm.pushEvent(e);
 
 		return true;
 	}
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java
index 80735e2..f9eec72 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java
@@ -8,14 +8,14 @@ public class ScummVMApplication extends Application {
 	public final static String ACTION_PLUGIN_QUERY = "org.inodes.gus.scummvm.action.PLUGIN_QUERY";
 	public final static String EXTRA_UNPACK_LIBS = "org.inodes.gus.scummvm.extra.UNPACK_LIBS";
 
-	private static File cache_dir;
+	private static File _cache_dir;
 
 	@Override
 	public void onCreate() {
 		super.onCreate();
 
 		// This is still on /data :(
-		cache_dir = getCacheDir();
+		_cache_dir = getCacheDir();
 		// This is mounted noexec :(
 		//cache_dir = new File(Environment.getExternalStorageDirectory(),
 		//				"/.ScummVM.tmp");
@@ -25,7 +25,7 @@ public class ScummVMApplication extends Application {
 	}
 
 	public static File getLastCacheDir() {
-		return cache_dir;
+		return _cache_dir;
 	}
 }
 


Commit: 7157454e9b30db91462cb684dd20a61204a7fa43
    https://github.com/scummvm/scummvm/commit/7157454e9b30db91462cb684dd20a61204a7fa43
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-03T12:29:15-08:00

Commit Message:
ANDROID: Implement surface resizes

Split surface code into helper functions to avoid code duplication, and
distinguish between screen resizes and surface recreation. The former
happens when toggling the softkeyb, where we just have to reset the
viewport. Fixes garbled textures in those cases.

Changed paths:
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/android/gfx.cpp



diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 35a6421..239ecd4 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -323,7 +323,8 @@ void OSystem_Android::initBackend() {
 	_audio_thread_exit = false;
 	pthread_create(&_audio_thread, 0, audioThreadFunc, this);
 
-	setupSurface();
+	initSurface();
+	initViewport();
 
 	_game_texture = new GLESPaletteTexture();
 	_overlay_texture = new GLES4444Texture();
@@ -404,42 +405,38 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
 	if (pthread_self() == _main_thread) {
 		if (_screen_changeid != JNI::surface_changeid) {
 			if (JNI::egl_surface_width > 0 && JNI::egl_surface_height > 0) {
-				LOGD("initializing surface");
+				if (_egl_surface_width > 0 && _egl_surface_height > 0) {
+					// surface still alive but changed
+					_screen_changeid = JNI::surface_changeid;
+					_egl_surface_width = JNI::egl_surface_width;
+					_egl_surface_height = JNI::egl_surface_height;
 
-				_game_texture->release();
-				_overlay_texture->release();
-				_mouse_texture->release();
+					initViewport();
+					// double buffered, flip twice
+					_force_redraw = true;
+					updateScreen();
+					_force_redraw = true;
 
-				JNI::deinitSurface();
-				setupSurface();
+					event.type = Common::EVENT_SCREEN_CHANGED;
 
-				_game_texture->reinit();
-				_overlay_texture->reinit();
-				_mouse_texture->reinit();
+					return true;
+				} else {
+					// new surface
+					initSurface();
+					_force_redraw = true;
 
-				event.type = Common::EVENT_SCREEN_CHANGED;
+					event.type = Common::EVENT_SCREEN_CHANGED;
 
-				return true;
+					return true;
+				}
+			} else {
+				// surface lost
+				deinitSurface();
 			}
-
-			LOGD("deinitialiting surface");
-
-			_game_texture->release();
-			_overlay_texture->release();
-			_mouse_texture->release();
-
-			_screen_changeid = JNI::surface_changeid;
-			JNI::deinitSurface();
 		}
 
 		if (JNI::pause) {
-			// release some resources
-			_game_texture->release();
-			_overlay_texture->release();
-			_mouse_texture->release();
-
-			LOGD("deinitialiting surface");
-			JNI::deinitSurface();
+			deinitSurface();
 
 			LOGD("main thread going to sleep");
 			sem_wait(&JNI::pause_sem);
@@ -596,7 +593,7 @@ void OSystem_Android::quit() {
 	delete _overlay_texture;
 	delete _mouse_texture;
 
-	JNI::deinitSurface();
+	deinitSurface();
 }
 
 void OSystem_Android::setWindowCaption(const char *caption) {
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 5db10fb..bf72f98 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -140,7 +140,10 @@ private:
 	FilesystemFactory *_fsFactory;
 	timeval _startTime;
 
-	void setupSurface();
+	void initSurface();
+	void deinitSurface();
+	void initViewport();
+
 	void setupKeymapper();
 	void _setCursorPalette(const byte *colors, uint start, uint num);
 
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index e2cc854..31e8c4b 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -62,20 +62,60 @@ int OSystem_Android::getGraphicsMode() const {
 	return 1;
 }
 
-void OSystem_Android::setupSurface() {
-	ENTER();
+void OSystem_Android::initSurface() {
+	LOGD("initializing surface");
 
-	_screen_changeid = JNI::surface_changeid;
-	JNI::initSurface();
+	assert(!JNI::haveSurface());
 
+	_screen_changeid = JNI::surface_changeid;
 	_egl_surface_width = JNI::egl_surface_width;
 	_egl_surface_height = JNI::egl_surface_height;
 
 	assert(_egl_surface_width > 0 && _egl_surface_height > 0);
 
-	// EGL set up with a new surface.  Initialise OpenGLES context.
+	JNI::initSurface();
+
+	// Initialise OpenGLES context.
 	GLESTexture::initGLExtensions();
 
+	if (_game_texture)
+		_game_texture->reinit();
+
+	if (_overlay_texture)
+		_overlay_texture->reinit();
+
+	if (_mouse_texture)
+		_mouse_texture->reinit();
+}
+
+void OSystem_Android::deinitSurface() {
+	if (!JNI::haveSurface())
+		return;
+
+	LOGD("deinitializing surface");
+
+	_screen_changeid = JNI::surface_changeid;
+	_egl_surface_width = 0;
+	_egl_surface_height = 0;
+
+	// release texture resources
+	if (_game_texture)
+		_game_texture->release();
+
+	if (_overlay_texture)
+		_overlay_texture->release();
+
+	if (_mouse_texture)
+		_mouse_texture->release();
+
+	JNI::deinitSurface();
+}
+
+void OSystem_Android::initViewport() {
+	LOGD("initializing viewport");
+
+	assert(JNI::haveSurface());
+
 	// Turn off anything that looks like 3D ;)
 	GLCALL(glDisable(GL_CULL_FACE));
 	GLCALL(glDisable(GL_DEPTH_TEST));
@@ -210,8 +250,8 @@ void OSystem_Android::updateScreen() {
 	}
 
 	if (_focus_rect.isEmpty()) {
-		_game_texture->drawTexture(0, 0,
-									_egl_surface_width, _egl_surface_height);
+		_game_texture->drawTexture(0, 0, _egl_surface_width,
+									_egl_surface_height);
 	} else {
 		GLCALL(glPushMatrix());
 		GLCALL(glScalex(xdiv(_egl_surface_width, _focus_rect.width()),
@@ -223,8 +263,8 @@ void OSystem_Android::updateScreen() {
 						xdiv(_game_texture->height(), _egl_surface_height),
 						1 << 16));
 
-		_game_texture->drawTexture(0, 0,
-									_egl_surface_width, _egl_surface_height);
+		_game_texture->drawTexture(0, 0, _egl_surface_width,
+									_egl_surface_height);
 		GLCALL(glPopMatrix());
 	}
 
@@ -234,9 +274,8 @@ void OSystem_Android::updateScreen() {
 		// ugly, but the modern theme sets a wacko factor, only god knows why
 		cs = 1;
 
-		GLCALL(_overlay_texture->drawTexture(0, 0,
-												_egl_surface_width,
-												_egl_surface_height));
+		GLCALL(_overlay_texture->drawTexture(0, 0, _egl_surface_width,
+													_egl_surface_height));
 	}
 
 	if (_show_mouse) {


Commit: ce9796baa3185417af53969e1258350648c2fc5a
    https://github.com/scummvm/scummvm/commit/ce9796baa3185417af53969e1258350648c2fc5a
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-03T12:29:47-08:00

Commit Message:
ANDROID: Don't wipe paletted textures on reinit

The content of a paletted texture is in _surface.pixels. When recreating
the surface, don't wipe its data unnecessarily. This fixes gfx garbage
on CLUT8 games/cursors when leaving and going back to ScummVM

Changed paths:
    backends/platform/android/texture.cpp
    backends/platform/android/texture.h



diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index cb12d26..fb9f3bb 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -109,14 +109,34 @@ void GLESTexture::release() {
 void GLESTexture::reinit() {
 	GLCALL(glGenTextures(1, &_texture_name));
 
-	// bypass allocBuffer() shortcut to reinit the texture properly
-	_texture_width = 0;
-	_texture_height = 0;
+	if (paletteSize()) {
+		// paletted textures are in a local buffer, don't wipe it
+		initSize();
+	} else {
+		// bypass allocBuffer() shortcut to reinit the texture properly
+		_texture_width = 0;
+		_texture_height = 0;
+
+		allocBuffer(_surface.w, _surface.h);
+	}
 
-	allocBuffer(_surface.w, _surface.h);
 	setDirty();
 }
 
+void GLESTexture::initSize() {
+	// Allocate room for the texture now, but pixel data gets uploaded
+	// 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_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(),
+						_texture_width, _texture_height,
+						0, glFormat(), glType(), 0));
+}
+
 void GLESTexture::allocBuffer(GLuint w, GLuint h) {
 	int bpp = bytesPerPixel();
 	_surface.w = w;
@@ -137,17 +157,7 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
 
 	_surface.pitch = _texture_width * bpp;
 
-	// Allocate room for the texture now, but pixel data gets uploaded
-	// 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_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(),
-						_texture_width, _texture_height,
-						0, glFormat(), glType(), 0));
+	initSize();
 }
 
 void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index f1d5cad..cc1f4e3 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -44,6 +44,7 @@ public:
 
 	void release();
 	void reinit();
+	void initSize();
 
 	virtual void allocBuffer(GLuint width, GLuint height);
 






More information about the Scummvm-git-logs mailing list