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

dhewg dhewg at wiibrew.org
Mon Mar 14 19:43:28 CET 2011


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

Summary:
57635fe75c ANDROID: Update screen rects on surface changes
e1575e57f8 ANDROID: Extend clearScreen to take care of all cases
f587b6ee04 ANDROID: Implement grabOverlay()
5b94159f40 ANDROID: Clear fake palette after allocating
6389e70e45 ANDROID: Remove clearBuffer()
d060b597c3 ANDROID: Fade out the game screen when the overlay is visible


Commit: 57635fe75cdf01a654d760efa0528a2aa186a391
    https://github.com/scummvm/scummvm/commit/57635fe75cdf01a654d760efa0528a2aa186a391
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-14T11:35:35-07:00

Commit Message:
ANDROID: Update screen rects on surface changes

Fixes regression introduced with 4267011e

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



diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 4d83dd7..85d4817 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -435,6 +435,8 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
 					_egl_surface_height = JNI::egl_surface_height;
 
 					initViewport();
+					updateScreenRect();
+
 					// double buffered, flip twice
 					_force_redraw = true;
 					updateScreen();
@@ -447,6 +449,8 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
 				} else {
 					// new surface
 					initSurface();
+					updateScreenRect();
+
 					_force_redraw = true;
 					updateScreen();
 
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index dc8acac..83ee8ba 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -296,7 +296,9 @@ void OSystem_Android::updateScreenRect() {
 
 	Common::Rect rect(0, 0, _egl_surface_width, _egl_surface_height);
 
-	if (!_fullscreen) {
+	_overlay_texture->setDrawRect(rect);
+
+	if (w && h && !_fullscreen) {
 		if (_ar_correction && w == 320 && h == 200)
 			h = 240;
 


Commit: e1575e57f818f57b022531f31161e521869d7483
    https://github.com/scummvm/scummvm/commit/e1575e57f818f57b022531f31161e521869d7483
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-14T11:35:35-07:00

Commit Message:
ANDROID: Extend clearScreen to take care of all cases

Hopefully that'll help me to not forget about the double buffering.
This fixes some gfx leftovers when not running games in fullscreen
mode.

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 85d4817..7731c53 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -438,10 +438,7 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
 					updateScreenRect();
 
 					// double buffered, flip twice
-					_force_redraw = true;
-					updateScreen();
-					_force_redraw = true;
-					updateScreen();
+					clearScreen(kClearUpdate, 2);
 
 					event.type = Common::EVENT_SCREEN_CHANGED;
 
@@ -451,8 +448,8 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
 					initSurface();
 					updateScreenRect();
 
-					_force_redraw = true;
-					updateScreen();
+					// double buffered, flip twice
+					clearScreen(kClearUpdate, 2);
 
 					event.type = Common::EVENT_SCREEN_CHANGED;
 
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 8e6d72f..db2cb95 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -186,7 +186,15 @@ public:
 
 	virtual void initSize(uint width, uint height,
 							const Graphics::PixelFormat *format);
-	void clearScreen(bool swapBuffers);
+
+	enum FixupType {
+		kClear = 0,		// glClear
+		kClearSwap,		// glClear + swapBuffers
+		kClearUpdate	// glClear + updateScreen
+	};
+
+	void clearScreen(FixupType type, byte count = 1);
+
 	void updateScreenRect();
 	virtual int getScreenChangeID() const;
 
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 83ee8ba..191d82e 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -278,26 +278,47 @@ void OSystem_Android::initSize(uint width, uint height,
 	// size (it's small).
 	_mouse_texture_palette->allocBuffer(20, 20);
 
-	clearScreen(true);
+	clearScreen(kClear);
 }
 
-void OSystem_Android::clearScreen(bool swapBuffers) {
-	// clear screen
-	GLCALL(glClearColorx(0, 0, 0, 1 << 16));
-	GLCALL(glClear(GL_COLOR_BUFFER_BIT));
+void OSystem_Android::clearScreen(FixupType type, byte count) {
+	assert(count > 0);
 
-	if (swapBuffers)
-		JNI::swapBuffers();
+	for (byte i = 0; i < count; ++i) {
+		if (!_show_overlay)
+			GLCALL(glDisable(GL_SCISSOR_TEST));
+
+		// clear screen
+		GLCALL(glClearColorx(0, 0, 0, 1 << 16));
+		GLCALL(glClear(GL_COLOR_BUFFER_BIT));
+
+		if (!_show_overlay)
+			GLCALL(glEnable(GL_SCISSOR_TEST));
+
+		switch (type) {
+		case kClear:
+			break;
+
+		case kClearSwap:
+			JNI::swapBuffers();
+			break;
+
+		case kClearUpdate:
+			_force_redraw = true;
+			updateScreen();
+			break;
+		}
+	}
 }
 
 void OSystem_Android::updateScreenRect() {
-	uint16 w = _game_texture->width();
-	uint16 h = _game_texture->height();
-
 	Common::Rect rect(0, 0, _egl_surface_width, _egl_surface_height);
 
 	_overlay_texture->setDrawRect(rect);
 
+	uint16 w = _game_texture->width();
+	uint16 h = _game_texture->height();
+
 	if (w && h && !_fullscreen) {
 		if (_ar_correction && w == 320 && h == 200)
 			h = 240;
@@ -404,7 +425,7 @@ void OSystem_Android::updateScreen() {
 
 	// clear pointer leftovers in dead areas
 	if (_show_overlay && !_fullscreen)
-		clearScreen(false);
+		clearScreen(kClear);
 
 	GLCALL(glPushMatrix());
 
@@ -414,7 +435,7 @@ void OSystem_Android::updateScreen() {
 							_game_texture->height()).contains(_focus_rect))) {
 		// These are the only cases where _game_texture doesn't
 		// cover the entire screen.
-		clearScreen(false);
+		clearScreen(kClear);
 
 		// Move everything up by _shake_offset (game) pixels
 		GLCALL(glTranslatex(0, -_shake_offset << 16, 0));
@@ -574,7 +595,8 @@ void OSystem_Android::hideOverlay() {
 	_show_overlay = false;
 	_force_redraw = true;
 
-	clearScreen(false);
+	// double buffered, flip twice
+	clearScreen(kClearUpdate, 2);
 
 	GLCALL(glEnable(GL_SCISSOR_TEST));
 }


Commit: f587b6ee04b18366205277f76c3f048313e971a6
    https://github.com/scummvm/scummvm/commit/f587b6ee04b18366205277f76c3f048313e971a6
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-14T11:35:36-07:00

Commit Message:
ANDROID: Implement grabOverlay()

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



diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 191d82e..2a66fcf 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -253,6 +253,7 @@ void OSystem_Android::initOverlay() {
 	LOGI("overlay size is %ux%u", overlay_width, overlay_height);
 
 	_overlay_texture->allocBuffer(overlay_width, overlay_height);
+	_overlay_texture->clearBuffer();
 	_overlay_texture->setDrawRect(0, 0,
 									_egl_surface_width, _egl_surface_height);
 }
@@ -618,17 +619,15 @@ void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) {
 
 	GLTHREADCHECK;
 
-	// We support overlay alpha blending, so the pixel data here
-	// shouldn't actually be used.	Let's fill it with zeros, I'm sure
-	// it will be fine...
 	const Graphics::Surface *surface = _overlay_texture->surface_const();
 	assert(surface->bytesPerPixel == sizeof(buf[0]));
 
+	const byte *src = (const byte *)surface->pixels;
 	uint h = surface->h;
 
 	do {
-		memset(buf, 0, surface->w * sizeof(buf[0]));
-
+		memcpy(buf, src, surface->w * surface->bytesPerPixel);
+		src += surface->pitch;
 		// This 'pitch' is pixels not bytes
 		buf += pitch;
 	} while (--h);


Commit: 5b94159f40fba8edaf15bf8961c479898646eb2d
    https://github.com/scummvm/scummvm/commit/5b94159f40fba8edaf15bf8961c479898646eb2d
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-14T11:35:36-07:00

Commit Message:
ANDROID: Clear fake palette after allocating

Gets rid of funky gfx artifacts on the overlay

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



diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index bbfd1f0..9501d94 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -480,6 +480,8 @@ GLESFakePaletteTexture::GLESFakePaletteTexture(GLenum glFormat, GLenum glType,
 
 	_palette = new uint16[256];
 	assert(_palette);
+
+	memset(_palette, 0, 256 * 2);
 }
 
 GLESFakePaletteTexture::~GLESFakePaletteTexture() {


Commit: 6389e70e45864aaec860481cc25208f1a9ca4a76
    https://github.com/scummvm/scummvm/commit/6389e70e45864aaec860481cc25208f1a9ca4a76
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-14T11:35:36-07:00

Commit Message:
ANDROID: Remove clearBuffer()

Not required. Why did i add that again?

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



diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 2a66fcf..dfab825 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -146,7 +146,7 @@ void OSystem_Android::initTexture(GLESBaseTexture **texture,
 	}
 
 	(*texture)->allocBuffer(width, height);
-	(*texture)->clearBuffer();
+	(*texture)->fillBuffer(0);
 }
 #endif
 
@@ -253,7 +253,7 @@ void OSystem_Android::initOverlay() {
 	LOGI("overlay size is %ux%u", overlay_width, overlay_height);
 
 	_overlay_texture->allocBuffer(overlay_width, overlay_height);
-	_overlay_texture->clearBuffer();
+	_overlay_texture->fillBuffer(0);
 	_overlay_texture->setDrawRect(0, 0,
 									_egl_surface_width, _egl_surface_height);
 }
@@ -268,7 +268,7 @@ void OSystem_Android::initSize(uint width, uint height,
 	initTexture(&_game_texture, width, height, format);
 #else
 	_game_texture->allocBuffer(width, height);
-	_game_texture->clearBuffer();
+	_game_texture->fillBuffer(0);
 #endif
 
 	updateScreenRect();
@@ -726,7 +726,7 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
 
 			delete[] tmp;
 
-			_mouse_texture->clearBuffer();
+			_mouse_texture->fillBuffer(0);
 
 			return;
 		}
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 9501d94..87a8c2e 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -280,10 +280,6 @@ void GLESTexture::fillBuffer(uint32 color) {
 	setDirty();
 }
 
-void GLESTexture::clearBuffer() {
-	fillBuffer(_pixelFormat.ARGBToColor(0xff, 0, 0, 0));
-}
-
 void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
 	if (_all_dirty) {
 		_dirty_rect.top = 0;
@@ -394,10 +390,6 @@ void GLESPaletteTexture::fillBuffer(uint32 color) {
 	setDirty();
 }
 
-void GLESPaletteTexture::clearBuffer() {
-	fillBuffer(0);
-}
-
 void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
 										const void *buf, int pitch_buf) {
 	setDirtyRect(Common::Rect(x, y, x + w, y + h));
@@ -520,10 +512,6 @@ void GLESFakePaletteTexture::fillBuffer(uint32 color) {
 	setDirty();
 }
 
-void GLESFakePaletteTexture::clearBuffer() {
-	fillBuffer(_palettePixelFormat.ARGBToColor(0xff, 0, 0, 0));
-}
-
 void GLESFakePaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w,
 											GLuint h, const void *buf,
 											int pitch_buf) {
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index 1fe18bf..4f2bfe4 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -58,7 +58,6 @@ public:
 	virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
 								const void *buf, int pitch_buf) = 0;
 	virtual void fillBuffer(uint32 color) = 0;
-	virtual void clearBuffer() = 0;
 
 	virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
 
@@ -183,7 +182,6 @@ public:
 	virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
 								const void *buf, int pitch_buf);
 	virtual void fillBuffer(uint32 color);
-	virtual void clearBuffer();
 
 	virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
 
@@ -237,7 +235,6 @@ public:
 	virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
 								const void *buf, int pitch_buf);
 	virtual void fillBuffer(uint32 color);
-	virtual void clearBuffer();
 
 	virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
 
@@ -302,7 +299,6 @@ public:
 	virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
 								const void *buf, int pitch_buf);
 	virtual void fillBuffer(uint32 color);
-	virtual void clearBuffer();
 
 	virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
 


Commit: d060b597c38d6332ae4eb79d051427a2381bfc5c
    https://github.com/scummvm/scummvm/commit/d060b597c38d6332ae4eb79d051427a2381bfc5c
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-14T11:35:36-07:00

Commit Message:
ANDROID: Fade out the game screen when the overlay is visible

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



diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index dfab825..d08cc63 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -442,6 +442,9 @@ void OSystem_Android::updateScreen() {
 		GLCALL(glTranslatex(0, -_shake_offset << 16, 0));
 	}
 
+	if (_show_overlay)
+		GLCALL(glColor4ub(0x9f, 0x9f, 0x9f, 0x9f));
+
 	if (_focus_rect.isEmpty()) {
 		_game_texture->drawTextureRect();
 	} else {
@@ -462,6 +465,8 @@ void OSystem_Android::updateScreen() {
 	int cs = _mouse_targetscale;
 
 	if (_show_overlay) {
+		GLCALL(glColor4ub(0xff, 0xff, 0xff, 0xff));
+
 		// ugly, but the modern theme sets a wacko factor, only god knows why
 		cs = 1;
 






More information about the Scummvm-git-logs mailing list