Fix dirty tracking in paletted textures.

svn-id: r49552
This commit is contained in:
Angus Lees 2010-06-09 21:31:48 +00:00
parent d8050029f9
commit d44efa817f

View File

@ -178,23 +178,22 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
ENTER("updateBuffer(%u, %u, %u, %u, %p, %d)", x, y, w, h, buf, pitch); ENTER("updateBuffer(%u, %u, %u, %u, %p, %d)", x, y, w, h, buf, pitch);
glBindTexture(GL_TEXTURE_2D, _texture_name); glBindTexture(GL_TEXTURE_2D, _texture_name);
setDirtyRect(Common::Rect(x, y, x+w, y+h));
if (static_cast<int>(w) * bytesPerPixel() == pitch) { if (static_cast<int>(w) * bytesPerPixel() == pitch) {
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h,
glFormat(), glType(), buf); glFormat(), glType(), buf);
} else { } else {
// GLES removed the ability to specify pitch, so we // GLES removed the ability to specify pitch, so we
// have to do this row by row. // have to do this row by row.
int i = h;
const byte* src = static_cast<const byte*>(buf); const byte* src = static_cast<const byte*>(buf);
do { do {
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, glTexSubImage2D(GL_TEXTURE_2D, 0, x, y,
w, 1, glFormat(), glType(), src); w, 1, glFormat(), glType(), src);
++y; ++y;
src += pitch; src += pitch;
} while (--i); } while (--h);
} }
setDirtyRect(Common::Rect(x, y, x+w, y+h));
} }
void GLESTexture::fillBuffer(byte x) { void GLESTexture::fillBuffer(byte x) {
@ -297,6 +296,8 @@ void GLESPaletteTexture::fillBuffer(byte x) {
void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y,
GLuint w, GLuint h, GLuint w, GLuint h,
const void* buf, int pitch) { const void* buf, int pitch) {
_all_dirty = true;
const byte* src = static_cast<const byte*>(buf); const byte* src = static_cast<const byte*>(buf);
byte* dst = static_cast<byte*>(_surface.getBasePtr(x, y)); byte* dst = static_cast<byte*>(_surface.getBasePtr(x, y));
do { do {