aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorJohannes Schickel2011-04-17 21:14:19 +0200
committerJohannes Schickel2011-04-17 21:14:19 +0200
commit877004dbdd967d2f57d494b1aaa1cb55aae0fd52 (patch)
treefe3630f18560b876300c42d50b2993b7b8da32da /backends/platform
parent3fd919060ca6bbf896680f3548bfaac020900d42 (diff)
downloadscummvm-rg350-877004dbdd967d2f57d494b1aaa1cb55aae0fd52.tar.gz
scummvm-rg350-877004dbdd967d2f57d494b1aaa1cb55aae0fd52.tar.bz2
scummvm-rg350-877004dbdd967d2f57d494b1aaa1cb55aae0fd52.zip
BACKENDS: Adapt various backends code to set up Surface::format correctly.
Note that this change is not tested at all (not even compile wise!).
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/android/gfx.cpp4
-rw-r--r--backends/platform/android/texture.cpp14
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp2
-rw-r--r--backends/platform/iphone/osys_video.cpp1
-rw-r--r--backends/platform/n64/osys_n64_base.cpp1
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp1
-rw-r--r--backends/platform/psp/default_display_client.cpp1
-rw-r--r--backends/platform/wii/osystem_gfx.cpp2
8 files changed, 18 insertions, 8 deletions
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 86232030ff..fae428d29f 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -628,13 +628,13 @@ void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) {
GLTHREADCHECK;
const Graphics::Surface *surface = _overlay_texture->surface_const();
- assert(surface->bytesPerPixel == sizeof(buf[0]));
+ assert(surface->format.bytesPerPixel == sizeof(buf[0]));
const byte *src = (const byte *)surface->pixels;
uint h = surface->h;
do {
- memcpy(buf, src, surface->w * surface->bytesPerPixel);
+ memcpy(buf, src, surface->w * surface->format.bytesPerPixel);
src += surface->pitch;
// This 'pitch' is pixels not bytes
buf += pitch;
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) {
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 92f9eb5e9e..b22bc437b0 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -757,6 +757,7 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
_framebuffer.h = DS::getGameHeight();
_framebuffer.pitch = DS::getGameWidth();
_framebuffer.bytesPerPixel = 1;
+ _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
} else {
@@ -782,6 +783,7 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
_framebuffer.h = height;
_framebuffer.pitch = width;
_framebuffer.bytesPerPixel = 1;
+ _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
}
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index c5e7ab8413..6f5b0e1e19 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -335,6 +335,7 @@ Graphics::Surface *OSystem_IPHONE::lockScreen() {
_framebuffer.h = _screenHeight;
_framebuffer.pitch = _screenWidth;
_framebuffer.bytesPerPixel = 1;
+ _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
return &_framebuffer;
}
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 54eab0fd52..5a6a7ef9c0 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -611,6 +611,7 @@ Graphics::Surface *OSystem_N64::lockScreen() {
_framebuffer.h = _gameHeight;
_framebuffer.pitch = _screenWidth;
_framebuffer.bytesPerPixel = 1;
+ _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
return &_framebuffer;
}
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 1c670764f9..22dae94527 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -399,6 +399,7 @@ Graphics::Surface *Gs2dScreen::lockScreen() {
_framebuffer.h = _height;
_framebuffer.pitch = _width; // -not- _pitch; ! It's EE mem, not Tex
_framebuffer.bytesPerPixel = 1;
+ _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
return &_framebuffer;
}
diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp
index bb42406c3e..cab9c15926 100644
--- a/backends/platform/psp/default_display_client.cpp
+++ b/backends/platform/psp/default_display_client.cpp
@@ -200,6 +200,7 @@ Graphics::Surface *Screen::lockAndGetForEditing() {
_frameBuffer.h = _buffer.getSourceHeight();
_frameBuffer.pitch = _buffer.getBytesPerPixel() * _buffer.getWidth();
_frameBuffer.bytesPerPixel = _buffer.getBytesPerPixel();
+ _frameBuffer.format = _pixelFormat;
// We'll set to dirty once we unlock the screen
return &_frameBuffer;
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index cb9a8c72e9..05952591a6 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -538,9 +538,11 @@ Graphics::Surface *OSystem_Wii::lockScreen() {
#ifdef USE_RGB_COLOR
_surface.pitch = _gameWidth * _pfGame.bytesPerPixel;
_surface.bytesPerPixel = _pfGame.bytesPerPixel;
+ _surface.format = _pfGame;
#else
_surface.pitch = _gameWidth;
_surface.bytesPerPixel = 1;
+ _surface.format = Graphics::PixelFormat::createFormatCLUT8();
#endif
return &_surface;