aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android
diff options
context:
space:
mode:
authordhewg2011-03-05 21:22:45 +0100
committerdhewg2011-03-05 23:08:41 +0100
commit53ee7c551369cf00b5073f10c21b836759b8c302 (patch)
tree61e8d09ef6916a2a427368d64cb89610bc397c64 /backends/platform/android
parenta2c02367f7fe76a6a76fbd872908274f679e4b4d (diff)
downloadscummvm-rg350-53ee7c551369cf00b5073f10c21b836759b8c302.tar.gz
scummvm-rg350-53ee7c551369cf00b5073f10c21b836759b8c302.tar.bz2
scummvm-rg350-53ee7c551369cf00b5073f10c21b836759b8c302.zip
ANDROID: Proper fillBuffer() for non CLUT8 colors
Diffstat (limited to 'backends/platform/android')
-rw-r--r--backends/platform/android/gfx.cpp2
-rw-r--r--backends/platform/android/texture.cpp13
-rw-r--r--backends/platform/android/texture.h4
3 files changed, 11 insertions, 8 deletions
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 12262f851b..10ffa3a7f6 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -458,8 +458,6 @@ void OSystem_Android::fillScreen(uint32 col) {
GLTHREADCHECK;
- // TODO FIXME rgb colors
- assert(col < 256);
_game_texture->fillBuffer(col);
}
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index e4c98e3ce0..7f3db0574b 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -212,13 +212,18 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
}
}
-void GLESTexture::fillBuffer(byte x) {
+void GLESTexture::fillBuffer(uint32 color) {
uint rowbytes = _surface.w * _bytesPerPixel;
byte *tmp = new byte[rowbytes];
assert(tmp);
- memset(tmp, x, rowbytes);
+ if (_bytesPerPixel == 1 || ((color & 0xff) == ((color >> 8) & 0xff))) {
+ memset(tmp, color & 0xff, rowbytes);
+ } else {
+ uint16 *p = (uint16 *)tmp;
+ Common::set_to(p, p + _surface.w, (uint16)color);
+ }
GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name));
GLCALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
@@ -346,9 +351,9 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) {
_surface.pixels = _texture + _paletteSize;
}
-void GLESPaletteTexture::fillBuffer(byte x) {
+void GLESPaletteTexture::fillBuffer(uint32 color) {
assert(_surface.pixels);
- memset(_surface.pixels, x, _surface.pitch * _surface.h);
+ memset(_surface.pixels, color & 0xff, _surface.pitch * _surface.h);
setDirty();
}
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index 14eea44914..e3d4463716 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -55,7 +55,7 @@ public:
virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
const void *buf, int pitch);
- virtual void fillBuffer(byte x);
+ virtual void fillBuffer(uint32 color);
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
@@ -164,7 +164,7 @@ public:
virtual void allocBuffer(GLuint width, GLuint height);
virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
const void *buf, int pitch);
- virtual void fillBuffer(byte x);
+ virtual void fillBuffer(uint32 color);
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);