aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/texture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/android/texture.cpp')
-rw-r--r--backends/platform/android/texture.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index a6b28ca485..5931902906 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -148,6 +148,7 @@ void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) {
_surface.w = w;
_surface.h = h;
_surface.bytesPerPixel = _pixelFormat.bytesPerPixel;
+ _surface.format = _pixelFormat;
if (w == _texture_width && h == _texture_height)
return;
@@ -241,14 +242,14 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
delete[] _buf;
delete[] _pixels;
- _pixels = new byte[w * h * _surface.bytesPerPixel];
+ _pixels = new byte[w * h * _surface.format.bytesPerPixel];
assert(_pixels);
_surface.pixels = _pixels;
fillBuffer(0);
- _buf = new byte[w * h * _surface.bytesPerPixel];
+ _buf = new byte[w * h * _surface.format.bytesPerPixel];
assert(_buf);
}
@@ -257,10 +258,10 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
setDirtyRect(Common::Rect(x, y, x + w, y + h));
const byte *src = (const byte *)buf;
- byte *dst = _pixels + y * _surface.pitch + x * _surface.bytesPerPixel;
+ byte *dst = _pixels + y * _surface.pitch + x * _surface.format.bytesPerPixel;
do {
- memcpy(dst, src, w * _surface.bytesPerPixel);
+ memcpy(dst, src, w * _surface.format.bytesPerPixel);
dst += _surface.pitch;
src += pitch_buf;
} while (--h);
@@ -301,10 +302,10 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
_tex = _buf;
byte *src = _pixels + _dirty_rect.top * _surface.pitch +
- _dirty_rect.left * _surface.bytesPerPixel;
+ _dirty_rect.left * _surface.format.bytesPerPixel;
byte *dst = _buf;
- uint16 l = dwidth * _surface.bytesPerPixel;
+ uint16 l = dwidth * _surface.format.bytesPerPixel;
for (uint16 i = 0; i < dheight; ++i) {
memcpy(dst, src, l);
@@ -374,6 +375,7 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) {
GLESBaseTexture::allocBuffer(w, h);
_surface.bytesPerPixel = 1;
+ _surface.format = Graphics::PixelFormat::createFormatCLUT8();
_surface.pitch = w;
if (_surface.w == oldw && _surface.h == oldh) {