aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/texture.cpp
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/texture.cpp
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/texture.cpp')
-rw-r--r--backends/platform/android/texture.cpp13
1 files changed, 9 insertions, 4 deletions
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();
}