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

dhewg dhewg at wiibrew.org
Thu Mar 24 19:14:55 CET 2011


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

Summary:
397fd31a17 ANDROID: Cleanup
e6080087c8 ANDROID: Fix cursor's keycolor


Commit: 397fd31a17f007a610aa7b673170983414efb5d5
    https://github.com/scummvm/scummvm/commit/397fd31a17f007a610aa7b673170983414efb5d5
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-24T10:56:54-07:00

Commit Message:
ANDROID: Cleanup

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



diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 5b03af9..e32e209 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -146,7 +146,6 @@ void OSystem_Android::initTexture(GLESBaseTexture **texture,
 	}
 
 	(*texture)->allocBuffer(width, height);
-	(*texture)->fillBuffer(0);
 }
 #endif
 
@@ -253,7 +252,6 @@ void OSystem_Android::initOverlay() {
 	LOGI("overlay size is %ux%u", overlay_width, overlay_height);
 
 	_overlay_texture->allocBuffer(overlay_width, overlay_height);
-	_overlay_texture->fillBuffer(0);
 	_overlay_texture->setDrawRect(0, 0,
 									_egl_surface_width, _egl_surface_height);
 }
@@ -268,7 +266,6 @@ void OSystem_Android::initSize(uint width, uint height,
 	initTexture(&_game_texture, width, height, format);
 #else
 	_game_texture->allocBuffer(width, height);
-	_game_texture->fillBuffer(0);
 #endif
 
 	updateScreenRect();
@@ -710,8 +707,8 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
 		assert(keycolor < 256);
 
 		byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
-
 		WRITE_UINT16(p, READ_UINT16(p) | 1);
+
 		_mouse_keycolor = keycolor;
 		WRITE_UINT16(_mouse_texture_palette->palette() + keycolor * 2, 0);
 	}
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 691c384..b96d6bf 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -229,8 +229,10 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
 
 	GLESBaseTexture::allocBuffer(w, h);
 
-	if (_surface.w == oldw && _surface.h == oldh)
+	if (_surface.w == oldw && _surface.h == oldh) {
+		fillBuffer(0);
 		return;
+	}
 
 	delete[] _buf;
 	delete[] _pixels;
@@ -241,6 +243,8 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
 	_surface.pixels = _pixels;
 	_surface.pitch = w * _pixelFormat.bytesPerPixel;
 
+	fillBuffer(0);
+
 	_buf = new byte[w * h * _surface.bytesPerPixel];
 	assert(_buf);
 }
@@ -358,22 +362,26 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) {
 
 	GLESBaseTexture::allocBuffer(w, h);
 
-	if (_surface.w == oldw && _surface.h == oldh)
+	if (_surface.w == oldw && _surface.h == oldh) {
+		fillBuffer(0);
 		return;
+	}
 
-	byte *new_buffer = new byte[_paletteSize +
-						_texture_width * _texture_height];
-	assert(new_buffer);
+	byte *old_texture = _texture;
 
-	if (_texture) {
-		// preserve palette
-		memcpy(new_buffer, _texture, _paletteSize);
-		delete[] _texture;
-	}
+	_texture = new byte[_paletteSize + _texture_width * _texture_height];
+	assert(_texture);
 
-	_texture = new_buffer;
 	_surface.pixels = _texture + _paletteSize;
 	_surface.pitch = _texture_width;
+
+	fillBuffer(0);
+
+	if (old_texture) {
+		// preserve palette
+		memcpy(_texture, old_texture, _paletteSize);
+		delete[] old_texture;
+	}
 }
 
 void GLESPaletteTexture::fillBuffer(uint32 color) {
@@ -480,8 +488,10 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) {
 
 	GLESBaseTexture::allocBuffer(w, h);
 
-	if (_surface.w == oldw && _surface.h == oldh)
+	if (_surface.w == oldw && _surface.h == oldh) {
+		fillBuffer(0);
 		return;
+	}
 
 	delete[] _buf;
 	delete[] _pixels;
@@ -494,6 +504,8 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) {
 	_surface.bytesPerPixel = 1;
 	_surface.pitch = w;
 
+	fillBuffer(0);
+
 	_buf = new uint16[w * h];
 	assert(_buf);
 }


Commit: e6080087c8453b5a0345bf62b2cd3809e46f7591
    https://github.com/scummvm/scummvm/commit/e6080087c8453b5a0345bf62b2cd3809e46f7591
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-24T10:56:59-07:00

Commit Message:
ANDROID: Fix cursor's keycolor

Don't wipe the RGB bits, fixes wrong colors on BASS cursors

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



diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index e32e209..bbd09ad 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -710,7 +710,9 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
 		WRITE_UINT16(p, READ_UINT16(p) | 1);
 
 		_mouse_keycolor = keycolor;
-		WRITE_UINT16(_mouse_texture_palette->palette() + keycolor * 2, 0);
+
+		p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
+		WRITE_UINT16(p, READ_UINT16(p) & ~1);
 	}
 
 	if (w == 0 || h == 0)
@@ -761,7 +763,8 @@ void OSystem_Android::setCursorPaletteInternal(const byte *colors,
 	for (uint i = 0; i < num; ++i, colors += 3, p += 2)
 		WRITE_UINT16(p, pf.RGBToColor(colors[0], colors[1], colors[2]));
 
-	WRITE_UINT16(_mouse_texture_palette->palette() + _mouse_keycolor * 2, 0);
+	p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
+	WRITE_UINT16(p, READ_UINT16(p) & ~1);
 }
 
 void OSystem_Android::setCursorPalette(const byte *colors,
@@ -804,7 +807,8 @@ void OSystem_Android::disableCursorPalette(bool disable) {
 			WRITE_UINT16(dst, pf_dst.RGBToColor(r, g, b));
 		}
 
-		WRITE_UINT16(_mouse_texture_palette->palette() + _mouse_keycolor * 2, 0);
+		byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
+		WRITE_UINT16(p, READ_UINT16(p) & ~1);
 	}
 
 	_use_mouse_palette = !disable;






More information about the Scummvm-git-logs mailing list