[Scummvm-cvs-logs] scummvm master -> 429b091ed1a4881bcc3d39686d764e72eb355b9e
dhewg
dhewg at wiibrew.org
Sat Mar 12 09:37:37 CET 2011
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4afa2c62b9 ANDROID: Get rid of ugly casts
99c0d82541 ANDROID: Cleanup paletted textures
7fe487f9cc ANDROID: Add more paletted texture types
2259f922f8 ANDROID: Remove redundant variable
caf21a357b ANDROID: Cleanup
0cdaff65c1 ANDROID: Use 16bit pixel formats on CLUT8 textures
429b091ed1 ANDROID: Convinience make target for testing
Commit: 4afa2c62b979251cb4d8ff7e5a97f5385a6287fe
https://github.com/scummvm/scummvm/commit/4afa2c62b979251cb4d8ff7e5a97f5385a6287fe
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-12T00:36:22-08:00
Commit Message:
ANDROID: Get rid of ugly casts
Changed paths:
backends/platform/android/gfx.cpp
backends/platform/android/texture.h
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 605f4eb..327ef06 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -300,8 +300,7 @@ void OSystem_Android::setPalette(const byte *colors, uint start, uint num) {
GLTHREADCHECK;
- memcpy(((GLESPaletteTexture *)_game_texture)->palette() + start * 3,
- colors, num * 3);
+ memcpy(_game_texture->palette() + start * 3, colors, num * 3);
if (!_use_mouse_palette)
setCursorPaletteInternal(colors, start, num);
@@ -316,8 +315,7 @@ void OSystem_Android::grabPalette(byte *colors, uint start, uint num) {
GLTHREADCHECK;
- memcpy(colors, ((GLESPaletteTexture *)_game_texture)->palette() + start * 3,
- num * 3);
+ memcpy(colors, _game_texture->palette() + start * 3, num * 3);
}
void OSystem_Android::copyRectToScreen(const byte *buf, int pitch,
@@ -685,7 +683,7 @@ void OSystem_Android::disableCursorPalette(bool disable) {
// when disabling the cursor palette, and we're running a clut8 game,
// it expects the game palette to be used for the cursor
if (disable && _game_texture->getPixelFormat().bytesPerPixel == 1) {
- byte *src = ((GLESPaletteTexture *)_game_texture)->palette();
+ byte *src = _game_texture->palette();
byte *dst = _mouse_texture_palette->palette();
for (uint i = 0; i < 256; ++i, src += 3, dst += 4) {
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index 78df43a..1ed16cb 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -84,6 +84,14 @@ public:
return &_surface;
}
+ virtual const byte *palette_const() const {
+ return 0;
+ };
+
+ virtual byte *palette() {
+ return 0;
+ };
+
inline bool dirty() const {
return _all_dirty || !_dirty_rect.isEmpty();
}
@@ -183,11 +191,11 @@ public:
drawTexture(0, 0, _surface.w, _surface.h);
}
- inline const byte *palette_const() const {
+ virtual const byte *palette_const() const {
return _texture;
};
- inline byte *palette() {
+ virtual byte *palette() {
setDirty();
return _texture;
};
Commit: 99c0d825418de549c42f26532eb444cdfa82e507
https://github.com/scummvm/scummvm/commit/99c0d825418de549c42f26532eb444cdfa82e507
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-12T00:36:22-08:00
Commit Message:
ANDROID: Cleanup paletted textures
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 327ef06..d0fc392 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -295,7 +295,7 @@ void OSystem_Android::setPalette(const byte *colors, uint start, uint num) {
ENTER("%p, %u, %u", colors, start, num);
#ifdef USE_RGB_COLOR
- assert(_game_texture->getPixelFormat().bytesPerPixel == 1);
+ assert(_game_texture->hasPalette());
#endif
GLTHREADCHECK;
@@ -310,7 +310,7 @@ void OSystem_Android::grabPalette(byte *colors, uint start, uint num) {
ENTER("%p, %u, %u", colors, start, num);
#ifdef USE_RGB_COLOR
- assert(_game_texture->getPixelFormat().bytesPerPixel == 1);
+ assert(_game_texture->hasPalette());
#endif
GLTHREADCHECK;
@@ -664,7 +664,7 @@ void OSystem_Android::setCursorPalette(const byte *colors,
GLTHREADCHECK;
- if (_mouse_texture->getPixelFormat().bytesPerPixel != 1) {
+ if (!_mouse_texture->hasPalette()) {
LOGD("switching to paletted mouse cursor");
_mouse_texture = _mouse_texture_palette;
@@ -682,7 +682,7 @@ void OSystem_Android::disableCursorPalette(bool disable) {
// when disabling the cursor palette, and we're running a clut8 game,
// it expects the game palette to be used for the cursor
- if (disable && _game_texture->getPixelFormat().bytesPerPixel == 1) {
+ if (disable && _game_texture->hasPalette()) {
byte *src = _game_texture->palette();
byte *dst = _mouse_texture_palette->palette();
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 24e6549..eb45de7 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -83,11 +83,10 @@ void GLESTexture::initGLExtensions() {
}
GLESTexture::GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
- size_t paletteSize, Graphics::PixelFormat pixelFormat) :
+ Graphics::PixelFormat pixelFormat) :
_bytesPerPixel(bytesPerPixel),
_glFormat(glFormat),
_glType(glType),
- _paletteSize(paletteSize),
_texture_name(0),
_surface(),
_texture_width(0),
@@ -111,7 +110,7 @@ void GLESTexture::release() {
void GLESTexture::reinit() {
GLCALL(glGenTextures(1, &_texture_name));
- if (_paletteSize) {
+ if (hasPalette()) {
// paletted textures are in a local buffer, don't wipe it
initSize();
} else {
@@ -239,7 +238,7 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
#ifdef GL_OES_draw_texture
// Great extension, but only works under specific conditions.
// Still a work-in-progress - disabled for now.
- if (false && draw_tex_supported && _paletteSize == 0) {
+ if (false && draw_tex_supported && !hasPalette()) {
//GLCALL(glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE));
const GLint crop[4] = { 0, _surface.h, _surface.w, -_surface.h };
@@ -280,21 +279,21 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
}
GLES4444Texture::GLES4444Texture() :
- GLESTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0, getPixelFormat()) {
+ GLESTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, getPixelFormat()) {
}
GLES4444Texture::~GLES4444Texture() {
}
GLES5551Texture::GLES5551Texture() :
- GLESTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 0, getPixelFormat()) {
+ GLESTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, getPixelFormat()) {
}
GLES5551Texture::~GLES5551Texture() {
}
GLES565Texture::GLES565Texture() :
- GLESTexture(2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0, getPixelFormat()) {
+ GLESTexture(2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, getPixelFormat()) {
}
GLES565Texture::~GLES565Texture() {
@@ -302,8 +301,9 @@ GLES565Texture::~GLES565Texture() {
GLESPaletteTexture::GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat,
GLenum glType, size_t paletteSize) :
- GLESTexture(bytesPerPixel, glFormat, glType, paletteSize,
+ GLESTexture(bytesPerPixel, glFormat, glType,
Graphics::PixelFormat::createFormatCLUT8()),
+ _paletteSize(paletteSize),
_texture(0)
{
}
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index 1ed16cb..91ec9ff 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -42,7 +42,7 @@ public:
protected:
GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
- size_t paletteSize, Graphics::PixelFormat pixelFormat);
+ Graphics::PixelFormat pixelFormat);
public:
virtual ~GLESTexture();
@@ -92,6 +92,10 @@ public:
return 0;
};
+ inline bool hasPalette() const {
+ return palette_const() != 0;
+ }
+
inline bool dirty() const {
return _all_dirty || !_dirty_rect.isEmpty();
}
@@ -125,7 +129,6 @@ protected:
byte _bytesPerPixel;
GLenum _glFormat;
GLenum _glType;
- size_t _paletteSize;
GLuint _texture_name;
Graphics::Surface _surface;
@@ -202,6 +205,7 @@ public:
protected:
byte *_texture;
+ size_t _paletteSize;
};
// RGB888 256-entry paletted texture
Commit: 7fe487f9cc4cb4b7ee6a121f33b9d284bfc15ed7
https://github.com/scummvm/scummvm/commit/7fe487f9cc4cb4b7ee6a121f33b9d284bfc15ed7
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-12T00:36:22-08:00
Commit Message:
ANDROID: Add more paletted texture types
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 eb45de7..603ef3a 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -93,7 +93,8 @@ GLESTexture::GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
_texture_height(0),
_all_dirty(false),
_dirty_rect(),
- _pixelFormat(pixelFormat)
+ _pixelFormat(pixelFormat),
+ _palettePixelFormat()
{
GLCALL(glGenTextures(1, &_texture_name));
}
@@ -300,12 +301,14 @@ GLES565Texture::~GLES565Texture() {
}
GLESPaletteTexture::GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat,
- GLenum glType, size_t paletteSize) :
+ GLenum glType,
+ Graphics::PixelFormat palettePixelFormat) :
GLESTexture(bytesPerPixel, glFormat, glType,
Graphics::PixelFormat::createFormatCLUT8()),
- _paletteSize(paletteSize),
_texture(0)
{
+ _palettePixelFormat = palettePixelFormat;
+ _paletteSize = _palettePixelFormat.bytesPerPixel * 256;
}
GLESPaletteTexture::~GLESPaletteTexture() {
@@ -368,18 +371,44 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
}
GLESPalette888Texture::GLESPalette888Texture() :
- GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_RGB8_OES, 256 * 3) {
+ GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_RGB8_OES,
+ Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0)) {
}
GLESPalette888Texture::~GLESPalette888Texture() {
}
GLESPalette8888Texture::GLESPalette8888Texture() :
- GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA8_OES, 256 * 4) {
+ GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA8_OES,
+ Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) {
}
GLESPalette8888Texture::~GLESPalette8888Texture() {
}
+GLESPalette565Texture::GLESPalette565Texture() :
+ GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_R5_G6_B5_OES,
+ Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) {
+}
+
+GLESPalette565Texture::~GLESPalette565Texture() {
+}
+
+GLESPalette4444Texture::GLESPalette4444Texture() :
+ GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA4_OES,
+ Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) {
+}
+
+GLESPalette4444Texture::~GLESPalette4444Texture() {
+}
+
+GLESPalette5551Texture::GLESPalette5551Texture() :
+ GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGB5_A1_OES,
+ Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)) {
+}
+
+GLESPalette5551Texture::~GLESPalette5551Texture() {
+}
+
#endif
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index 91ec9ff..f00a5898 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -93,7 +93,7 @@ public:
};
inline bool hasPalette() const {
- return palette_const() != 0;
+ return _palettePixelFormat.bytesPerPixel > 0;
}
inline bool dirty() const {
@@ -104,6 +104,10 @@ public:
return _pixelFormat;
}
+ inline const Graphics::PixelFormat &getPalettePixelFormat() const {
+ return _palettePixelFormat;
+ }
+
protected:
inline void setDirty() {
_all_dirty = true;
@@ -140,6 +144,7 @@ protected:
Common::Rect _dirty_rect;
Graphics::PixelFormat _pixelFormat;
+ Graphics::PixelFormat _palettePixelFormat;
};
// RGBA4444 texture
@@ -178,7 +183,7 @@ public:
class GLESPaletteTexture : public GLESTexture {
protected:
GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
- size_t paletteSize);
+ Graphics::PixelFormat palettePixelFormat);
public:
virtual ~GLESPaletteTexture();
@@ -222,6 +227,27 @@ public:
virtual ~GLESPalette8888Texture();
};
+// RGB565 256-entry paletted texture
+class GLESPalette565Texture : public GLESPaletteTexture {
+public:
+ GLESPalette565Texture();
+ virtual ~GLESPalette565Texture();
+};
+
+// RGBA4444 256-entry paletted texture
+class GLESPalette4444Texture : public GLESPaletteTexture {
+public:
+ GLESPalette4444Texture();
+ virtual ~GLESPalette4444Texture();
+};
+
+// RGBA5551 256-entry paletted texture
+class GLESPalette5551Texture : public GLESPaletteTexture {
+public:
+ GLESPalette5551Texture();
+ virtual ~GLESPalette5551Texture();
+};
+
#endif
#endif
Commit: 2259f922f8c2a7b2839edf8f4ae9bbe17c1016ab
https://github.com/scummvm/scummvm/commit/2259f922f8c2a7b2839edf8f4ae9bbe17c1016ab
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-12T00:36:22-08:00
Commit Message:
ANDROID: Remove redundant variable
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 603ef3a..dbba275 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -82,9 +82,8 @@ void GLESTexture::initGLExtensions() {
}
}
-GLESTexture::GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+GLESTexture::GLESTexture(GLenum glFormat, GLenum glType,
Graphics::PixelFormat pixelFormat) :
- _bytesPerPixel(bytesPerPixel),
_glFormat(glFormat),
_glType(glType),
_texture_name(0),
@@ -142,7 +141,7 @@ void GLESTexture::initSize() {
void GLESTexture::allocBuffer(GLuint w, GLuint h) {
_surface.w = w;
_surface.h = h;
- _surface.bytesPerPixel = _bytesPerPixel;
+ _surface.bytesPerPixel = _pixelFormat.bytesPerPixel;
// Already allocated a sufficiently large buffer?
if (w <= _texture_width && h <= _texture_height)
@@ -156,7 +155,7 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
_texture_height = nextHigher2(_surface.h);
}
- _surface.pitch = _texture_width * _bytesPerPixel;
+ _surface.pitch = _texture_width * _pixelFormat.bytesPerPixel;
initSize();
}
@@ -170,14 +169,14 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
setDirtyRect(Common::Rect(x, y, x + w, y + h));
- if (static_cast<int>(w) * _bytesPerPixel == pitch_buf) {
+ if (static_cast<int>(w) * _pixelFormat.bytesPerPixel == pitch_buf) {
GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h,
_glFormat, _glType, buf));
} else {
// GLES removed the ability to specify pitch, so we
// have to do this ourselves.
#if TEXSUBIMAGE_IS_EXPENSIVE
- byte *tmp = new byte[w * h * _bytesPerPixel];
+ byte *tmp = new byte[w * h * _pixelFormat.bytesPerPixel];
assert(tmp);
const byte *src = static_cast<const byte *>(buf);
@@ -185,8 +184,8 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
GLuint count = h;
do {
- memcpy(dst, src, w * _bytesPerPixel);
- dst += w * _bytesPerPixel;
+ memcpy(dst, src, w * _pixelFormat.bytesPerPixel);
+ dst += w * _pixelFormat.bytesPerPixel;
src += pitch_buf;
} while (--count);
@@ -209,12 +208,13 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
}
void GLESTexture::fillBuffer(uint32 color) {
- uint rowbytes = _surface.w * _bytesPerPixel;
+ uint rowbytes = _surface.w * _pixelFormat.bytesPerPixel;
byte *tmp = new byte[rowbytes];
assert(tmp);
- if (_bytesPerPixel == 1 || ((color & 0xff) == ((color >> 8) & 0xff))) {
+ if (_pixelFormat.bytesPerPixel == 1 ||
+ ((color & 0xff) == ((color >> 8) & 0xff))) {
memset(tmp, color & 0xff, rowbytes);
} else {
uint16 *p = (uint16 *)tmp;
@@ -280,30 +280,29 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
}
GLES4444Texture::GLES4444Texture() :
- GLESTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, getPixelFormat()) {
+ GLESTexture(GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, getPixelFormat()) {
}
GLES4444Texture::~GLES4444Texture() {
}
GLES5551Texture::GLES5551Texture() :
- GLESTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, getPixelFormat()) {
+ GLESTexture(GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, getPixelFormat()) {
}
GLES5551Texture::~GLES5551Texture() {
}
GLES565Texture::GLES565Texture() :
- GLESTexture(2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, getPixelFormat()) {
+ GLESTexture(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, getPixelFormat()) {
}
GLES565Texture::~GLES565Texture() {
}
-GLESPaletteTexture::GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat,
- GLenum glType,
+GLESPaletteTexture::GLESPaletteTexture(GLenum glFormat, GLenum glType,
Graphics::PixelFormat palettePixelFormat) :
- GLESTexture(bytesPerPixel, glFormat, glType,
+ GLESTexture(glFormat, glType,
Graphics::PixelFormat::createFormatCLUT8()),
_texture(0)
{
@@ -321,7 +320,7 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) {
// Texture gets uploaded later (from drawTexture())
byte *new_buffer = new byte[_paletteSize +
- _texture_width * _texture_height * _bytesPerPixel];
+ _texture_width * _texture_height];
assert(new_buffer);
if (_texture) {
@@ -348,7 +347,7 @@ void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
byte *dst = static_cast<byte *>(_surface.getBasePtr(x, y));
do {
- memcpy(dst, src, w * _bytesPerPixel);
+ memcpy(dst, src, w);
dst += _surface.pitch;
src += pitch_buf;
} while (--h);
@@ -359,8 +358,8 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
if (dirty()) {
GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name));
- const size_t texture_size =
- _paletteSize + _texture_width * _texture_height * _bytesPerPixel;
+ const size_t texture_size = _paletteSize +
+ _texture_width * _texture_height;
GLCALL(glCompressedTexImage2D(GL_TEXTURE_2D, 0, _glType,
_texture_width, _texture_height,
@@ -371,7 +370,7 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
}
GLESPalette888Texture::GLESPalette888Texture() :
- GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_RGB8_OES,
+ GLESPaletteTexture(GL_RGB, GL_PALETTE8_RGB8_OES,
Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0)) {
}
@@ -379,7 +378,7 @@ GLESPalette888Texture::~GLESPalette888Texture() {
}
GLESPalette8888Texture::GLESPalette8888Texture() :
- GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA8_OES,
+ GLESPaletteTexture(GL_RGBA, GL_PALETTE8_RGBA8_OES,
Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) {
}
@@ -387,7 +386,7 @@ GLESPalette8888Texture::~GLESPalette8888Texture() {
}
GLESPalette565Texture::GLESPalette565Texture() :
- GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_R5_G6_B5_OES,
+ GLESPaletteTexture(GL_RGB, GL_PALETTE8_R5_G6_B5_OES,
Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) {
}
@@ -395,7 +394,7 @@ GLESPalette565Texture::~GLESPalette565Texture() {
}
GLESPalette4444Texture::GLESPalette4444Texture() :
- GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA4_OES,
+ GLESPaletteTexture(GL_RGBA, GL_PALETTE8_RGBA4_OES,
Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) {
}
@@ -403,7 +402,7 @@ GLESPalette4444Texture::~GLESPalette4444Texture() {
}
GLESPalette5551Texture::GLESPalette5551Texture() :
- GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGB5_A1_OES,
+ GLESPaletteTexture(GL_RGBA, GL_PALETTE8_RGB5_A1_OES,
Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)) {
}
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index f00a5898..02cb0c7 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -41,7 +41,7 @@ public:
static void initGLExtensions();
protected:
- GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+ GLESTexture(GLenum glFormat, GLenum glType,
Graphics::PixelFormat pixelFormat);
public:
@@ -130,7 +130,6 @@ protected:
}
}
- byte _bytesPerPixel;
GLenum _glFormat;
GLenum _glType;
@@ -182,7 +181,7 @@ public:
class GLESPaletteTexture : public GLESTexture {
protected:
- GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+ GLESPaletteTexture(GLenum glFormat, GLenum glType,
Graphics::PixelFormat palettePixelFormat);
public:
Commit: caf21a357bef24ced14d8b67c7f3f6687a767570
https://github.com/scummvm/scummvm/commit/caf21a357bef24ced14d8b67c7f3f6687a767570
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-12T00:36:22-08:00
Commit Message:
ANDROID: Cleanup
Changed paths:
backends/platform/android/android.h
backends/platform/android/gfx.cpp
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index f6406c4..ba1a47a 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -151,7 +151,7 @@ private:
#ifdef USE_RGB_COLOR
Common::String getPixelFormatName(const Graphics::PixelFormat &format) const;
void initTexture(GLESTexture **texture, uint width, uint height,
- const Graphics::PixelFormat *format, bool alphaPalette);
+ const Graphics::PixelFormat *format);
#endif
void setupKeymapper();
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index d0fc392..d7650fb 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -98,8 +98,7 @@ Common::String OSystem_Android::getPixelFormatName(const Graphics::PixelFormat &
void OSystem_Android::initTexture(GLESTexture **texture,
uint width, uint height,
- const Graphics::PixelFormat *format,
- bool alphaPalette) {
+ const Graphics::PixelFormat *format) {
assert(texture);
Graphics::PixelFormat format_clut8 =
Graphics::PixelFormat::createFormatCLUT8();
@@ -135,10 +134,7 @@ void OSystem_Android::initTexture(GLESTexture **texture,
LOGE("unsupported pixel format: %s",
getPixelFormatName(format_new).c_str());
- if (alphaPalette)
- *texture = new GLESPalette8888Texture;
- else
- *texture = new GLESPalette888Texture;
+ *texture = new GLESPalette888Texture;
}
LOGD("new pixel format: %s",
@@ -262,7 +258,7 @@ void OSystem_Android::initSize(uint width, uint height,
GLTHREADCHECK;
#ifdef USE_RGB_COLOR
- initTexture(&_game_texture, width, height, format, false);
+ initTexture(&_game_texture, width, height, format);
#else
_game_texture->allocBuffer(width, height);
_game_texture->fillBuffer(0);
Commit: 0cdaff65c104f11954167048455d4258d053e1cd
https://github.com/scummvm/scummvm/commit/0cdaff65c104f11954167048455d4258d053e1cd
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-12T00:36:23-08:00
Commit Message:
ANDROID: Use 16bit pixel formats on CLUT8 textures
This reduces the CPU usage on 640x480 games by ~5% on my droid when
reuploading the textures to the GPU
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 2be435c..ca65863 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -112,6 +112,8 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_mouse_texture(0),
_mouse_texture_palette(0),
_mouse_texture_rgb(0),
+ _mouse_hotspot(),
+ _mouse_keycolor(0),
_use_mouse_palette(false),
_show_mouse(false),
_show_overlay(false),
@@ -328,9 +330,9 @@ void OSystem_Android::initBackend() {
initSurface();
initViewport();
- _game_texture = new GLESPalette888Texture();
+ _game_texture = new GLESPalette565Texture();
_overlay_texture = new GLES4444Texture();
- _mouse_texture_palette = new GLESPalette8888Texture();
+ _mouse_texture_palette = new GLESPalette5551Texture();
_mouse_texture = _mouse_texture_palette;
initOverlay();
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index ba1a47a..f73131b 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -116,6 +116,7 @@ private:
GLESPaletteTexture *_mouse_texture_palette;
GLES5551Texture *_mouse_texture_rgb;
Common::Point _mouse_hotspot;
+ uint32 _mouse_keycolor;
int _mouse_targetscale;
bool _show_mouse;
bool _use_mouse_palette;
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index d7650fb..6be7a03 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -25,6 +25,7 @@
#if defined(__ANDROID__)
+#include "common/endian.h"
#include "graphics/conversion.h"
#include "backends/platform/android/android.h"
@@ -134,7 +135,7 @@ void OSystem_Android::initTexture(GLESTexture **texture,
LOGE("unsupported pixel format: %s",
getPixelFormatName(format_new).c_str());
- *texture = new GLESPalette888Texture;
+ *texture = new GLESPalette565Texture;
}
LOGD("new pixel format: %s",
@@ -296,10 +297,14 @@ void OSystem_Android::setPalette(const byte *colors, uint start, uint num) {
GLTHREADCHECK;
- memcpy(_game_texture->palette() + start * 3, colors, num * 3);
-
if (!_use_mouse_palette)
setCursorPaletteInternal(colors, start, num);
+
+ const Graphics::PixelFormat &pf = _game_texture->getPalettePixelFormat();
+ byte *p = _game_texture->palette() + start * 2;
+
+ for (uint i = 0; i < num; ++i, colors += 3, p += 2)
+ WRITE_UINT16(p, pf.RGBToColor(colors[0], colors[1], colors[2]));
}
void OSystem_Android::grabPalette(byte *colors, uint start, uint num) {
@@ -311,7 +316,11 @@ void OSystem_Android::grabPalette(byte *colors, uint start, uint num) {
GLTHREADCHECK;
- memcpy(colors, _game_texture->palette() + start * 3, num * 3);
+ const Graphics::PixelFormat &pf = _game_texture->getPalettePixelFormat();
+ const byte *p = _game_texture->palette_const() + start * 2;
+
+ for (uint i = 0; i < num; ++i, colors += 3, p += 2)
+ pf.colorToRGB(READ_UINT16(p), colors[0], colors[1], colors[2]);
}
void OSystem_Android::copyRectToScreen(const byte *buf, int pitch,
@@ -594,13 +603,11 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
if (_mouse_texture == _mouse_texture_palette) {
assert(keycolor < 256);
- // Update palette alpha based on keycolor
- byte *palette = _mouse_texture_palette->palette();
-
- for (uint i = 0; i < 256; ++i, palette += 4)
- palette[3] = 0xff;
+ byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
- _mouse_texture_palette->palette()[keycolor * 4 + 3] = 0;
+ WRITE_UINT16(p, READ_UINT16(p) | 1);
+ _mouse_keycolor = keycolor;
+ WRITE_UINT16(_mouse_texture_palette->palette() + keycolor * 2, 0);
}
if (w == 0 || h == 0)
@@ -644,14 +651,14 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
void OSystem_Android::setCursorPaletteInternal(const byte *colors,
uint start, uint num) {
- byte *palette = _mouse_texture_palette->palette() + start * 4;
+ const Graphics::PixelFormat &pf =
+ _mouse_texture_palette->getPalettePixelFormat();
+ byte *p = _mouse_texture_palette->palette() + start * 2;
- for (uint i = 0; i < num; ++i, palette += 4, colors += 3) {
- palette[0] = colors[0];
- palette[1] = colors[1];
- palette[2] = colors[2];
- // Leave alpha untouched to preserve keycolor
- }
+ 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);
}
void OSystem_Android::setCursorPalette(const byte *colors,
@@ -679,15 +686,22 @@ void OSystem_Android::disableCursorPalette(bool disable) {
// when disabling the cursor palette, and we're running a clut8 game,
// it expects the game palette to be used for the cursor
if (disable && _game_texture->hasPalette()) {
- byte *src = _game_texture->palette();
+ const byte *src = _game_texture->palette_const();
byte *dst = _mouse_texture_palette->palette();
- for (uint i = 0; i < 256; ++i, src += 3, dst += 4) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- // Leave alpha untouched to preserve keycolor
+ const Graphics::PixelFormat &pf_src =
+ _game_texture->getPalettePixelFormat();
+ const Graphics::PixelFormat &pf_dst =
+ _mouse_texture_palette->getPalettePixelFormat();
+
+ uint8 r, g, b;
+
+ for (uint i = 0; i < 256; ++i, src += 2, dst += 2) {
+ pf_src.colorToRGB(READ_UINT16(src), r, g, b);
+ WRITE_UINT16(dst, pf_dst.RGBToColor(r, g, b));
}
+
+ WRITE_UINT16(_mouse_texture_palette->palette() + _mouse_keycolor * 2, 0);
}
_use_mouse_palette = !disable;
Commit: 429b091ed1a4881bcc3d39686d764e72eb355b9e
https://github.com/scummvm/scummvm/commit/429b091ed1a4881bcc3d39686d764e72eb355b9e
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-12T00:36:23-08:00
Commit Message:
ANDROID: Convinience make target for testing
Changed paths:
backends/platform/android/android.mk
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index 1bc3c3d..eb58089 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -163,6 +163,10 @@ release/%.apk: %.apk
androidrelease: $(addprefix release/, $(APK_MAIN) $(APK_PLUGINS))
+androidtestmain: $(APK_MAIN)
+ $(ADB) install -r $(APK_MAIN)
+ $(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.inodes.gus.scummvm/.Unpacker
+
androidtest: $(APK_MAIN) $(APK_PLUGINS)
@set -e; for apk in $^; do \
$(ADB) install -r $$apk; \
More information about the Scummvm-git-logs
mailing list