ANDROID: Proper fillBuffer() for non CLUT8 colors
This commit is contained in:
parent
a2c02367f7
commit
53ee7c5513
3 changed files with 11 additions and 8 deletions
|
@ -458,8 +458,6 @@ void OSystem_Android::fillScreen(uint32 col) {
|
||||||
|
|
||||||
GLTHREADCHECK;
|
GLTHREADCHECK;
|
||||||
|
|
||||||
// TODO FIXME rgb colors
|
|
||||||
assert(col < 256);
|
|
||||||
_game_texture->fillBuffer(col);
|
_game_texture->fillBuffer(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
uint rowbytes = _surface.w * _bytesPerPixel;
|
||||||
|
|
||||||
byte *tmp = new byte[rowbytes];
|
byte *tmp = new byte[rowbytes];
|
||||||
assert(tmp);
|
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(glBindTexture(GL_TEXTURE_2D, _texture_name));
|
||||||
GLCALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
|
GLCALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
|
||||||
|
@ -346,9 +351,9 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) {
|
||||||
_surface.pixels = _texture + _paletteSize;
|
_surface.pixels = _texture + _paletteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLESPaletteTexture::fillBuffer(byte x) {
|
void GLESPaletteTexture::fillBuffer(uint32 color) {
|
||||||
assert(_surface.pixels);
|
assert(_surface.pixels);
|
||||||
memset(_surface.pixels, x, _surface.pitch * _surface.h);
|
memset(_surface.pixels, color & 0xff, _surface.pitch * _surface.h);
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
|
virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
|
||||||
const void *buf, int pitch);
|
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);
|
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 allocBuffer(GLuint width, GLuint height);
|
||||||
virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
|
virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
|
||||||
const void *buf, int pitch);
|
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);
|
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue