ANDROID: Fix texture clear color

This commit is contained in:
dhewg 2011-03-13 22:56:44 +01:00
parent 2dd669d808
commit c63c2a9e59
3 changed files with 19 additions and 3 deletions

View file

@ -143,7 +143,7 @@ void OSystem_Android::initTexture(GLESBaseTexture **texture,
} }
(*texture)->allocBuffer(width, height); (*texture)->allocBuffer(width, height);
(*texture)->fillBuffer(0); (*texture)->clearBuffer();
} }
#endif #endif
@ -264,7 +264,7 @@ void OSystem_Android::initSize(uint width, uint height,
initTexture(&_game_texture, width, height, format); initTexture(&_game_texture, width, height, format);
#else #else
_game_texture->allocBuffer(width, height); _game_texture->allocBuffer(width, height);
_game_texture->fillBuffer(0); _game_texture->clearBuffer();
#endif #endif
updateScreenRect(); updateScreenRect();
@ -686,7 +686,7 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
delete[] tmp; delete[] tmp;
_mouse_texture->fillBuffer(0); _mouse_texture->clearBuffer();
return; return;
} }

View file

@ -267,6 +267,10 @@ void GLESTexture::fillBuffer(uint32 color) {
setDirty(); setDirty();
} }
void GLESTexture::clearBuffer() {
fillBuffer(_pixelFormat.ARGBToColor(0xff, 0, 0, 0));
}
void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
if (_all_dirty) { if (_all_dirty) {
_dirty_rect.top = 0; _dirty_rect.top = 0;
@ -377,6 +381,10 @@ void GLESPaletteTexture::fillBuffer(uint32 color) {
setDirty(); setDirty();
} }
void GLESPaletteTexture::clearBuffer() {
fillBuffer(0);
}
void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
const void *buf, int pitch_buf) { const void *buf, int pitch_buf) {
setDirtyRect(Common::Rect(x, y, x + w, y + h)); setDirtyRect(Common::Rect(x, y, x + w, y + h));
@ -497,6 +505,10 @@ void GLESFakePaletteTexture::fillBuffer(uint32 color) {
setDirty(); setDirty();
} }
void GLESFakePaletteTexture::clearBuffer() {
fillBuffer(_palettePixelFormat.ARGBToColor(0xff, 0, 0, 0));
}
void GLESFakePaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w, void GLESFakePaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w,
GLuint h, const void *buf, GLuint h, const void *buf,
int pitch_buf) { int pitch_buf) {

View file

@ -56,6 +56,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_buf) = 0; const void *buf, int pitch_buf) = 0;
virtual void fillBuffer(uint32 color) = 0; virtual void fillBuffer(uint32 color) = 0;
virtual void clearBuffer() = 0;
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h); virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
@ -179,6 +180,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_buf); const void *buf, int pitch_buf);
virtual void fillBuffer(uint32 color); virtual void fillBuffer(uint32 color);
virtual void clearBuffer();
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h); virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
@ -232,6 +234,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_buf); const void *buf, int pitch_buf);
virtual void fillBuffer(uint32 color); virtual void fillBuffer(uint32 color);
virtual void clearBuffer();
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h); virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
@ -296,6 +299,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_buf); const void *buf, int pitch_buf);
virtual void fillBuffer(uint32 color); virtual void fillBuffer(uint32 color);
virtual void clearBuffer();
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h); virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);