aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/graphics/sdl/sdl-graphics.cpp3
-rw-r--r--backends/platform/android/texture.cpp2
-rw-r--r--backends/platform/dc/display.cpp2
-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
-rw-r--r--engines/hugo/intro.cpp3
-rw-r--r--engines/m4/graphics.h1
-rw-r--r--engines/scumm/cursor.cpp1
-rw-r--r--engines/scumm/gfx.cpp2
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp1
-rw-r--r--engines/tsage/graphics.cpp1
-rw-r--r--graphics/surface.cpp18
-rw-r--r--graphics/surface.h19
-rw-r--r--video/coktel_decoder.cpp3
-rw-r--r--video/dxa_decoder.cpp1
19 files changed, 4 insertions, 61 deletions
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 5279af9896..6b20c2f9c2 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -1287,10 +1287,8 @@ Graphics::Surface *SdlGraphicsManager::lockScreen() {
_framebuffer.h = _screen->h;
_framebuffer.pitch = _screen->pitch;
#ifdef USE_RGB_COLOR
- _framebuffer.bytesPerPixel = _screenFormat.bytesPerPixel;
_framebuffer.format = _screenFormat;
#else
- _framebuffer.bytesPerPixel = 1;
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
#endif
@@ -2056,7 +2054,6 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) {
dst.w = _osdSurface->w;
dst.h = _osdSurface->h;
dst.pitch = _osdSurface->pitch;
- dst.bytesPerPixel = _osdSurface->format->BytesPerPixel;
dst.format = Graphics::PixelFormat(_osdSurface->format->BytesPerPixel,
8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss,
8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss,
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 5931902906..2d73783309 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -147,7 +147,6 @@ void GLESBaseTexture::setLinearFilter(bool value) {
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)
@@ -374,7 +373,6 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) {
GLESBaseTexture::allocBuffer(w, h);
- _surface.bytesPerPixel = 1;
_surface.format = Graphics::PixelFormat::createFormatCLUT8();
_surface.pitch = w;
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index b297022775..78fa2182dc 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -720,7 +720,7 @@ Graphics::Surface *OSystem_Dreamcast::lockScreen()
_framebuffer.w = _screen_w;
_framebuffer.h = _screen_h;
_framebuffer.pitch = SCREEN_W*2;
- _framebuffer.bytesPerPixel = (_screenFormat == 0? 1 : 2);
+ _framebuffer.format = screenFormats[_screenFormat];
return &_framebuffer;
}
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index b22bc437b0..49818a0034 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -756,7 +756,6 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
_framebuffer.w = DS::getGameWidth();
_framebuffer.h = DS::getGameHeight();
_framebuffer.pitch = DS::getGameWidth();
- _framebuffer.bytesPerPixel = 1;
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
} else {
@@ -782,7 +781,6 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
_framebuffer.w = width;
_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 6f5b0e1e19..a10efeff40 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -334,7 +334,6 @@ Graphics::Surface *OSystem_IPHONE::lockScreen() {
_framebuffer.w = _screenWidth;
_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 5a6a7ef9c0..232037899b 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -610,7 +610,6 @@ Graphics::Surface *OSystem_N64::lockScreen() {
_framebuffer.w = _gameWidth;
_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 22dae94527..e43ea0f376 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -398,7 +398,6 @@ Graphics::Surface *Gs2dScreen::lockScreen() {
_framebuffer.w = _width;
_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 cab9c15926..34b1a70711 100644
--- a/backends/platform/psp/default_display_client.cpp
+++ b/backends/platform/psp/default_display_client.cpp
@@ -199,7 +199,6 @@ Graphics::Surface *Screen::lockAndGetForEditing() {
_frameBuffer.w = _buffer.getSourceWidth();
_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
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 05952591a6..c2be608999 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -537,11 +537,9 @@ Graphics::Surface *OSystem_Wii::lockScreen() {
_surface.h = _gameHeight;
#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
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp
index e79c0a72c0..c1c84d1e32 100644
--- a/engines/hugo/intro.cpp
+++ b/engines/hugo/intro.cpp
@@ -93,7 +93,6 @@ void intro_v1d::introInit() {
surf.h = 200;
surf.pixels = _vm->_screen->getFrontBuffer();
surf.pitch = 320;
- surf.bytesPerPixel = 1;
surf.format = Graphics::PixelFormat::createFormatCLUT8();
_vm->_screen->displayList(kDisplayInit);
}
@@ -248,7 +247,6 @@ void intro_v2d::introInit() {
surf.h = 200;
surf.pixels = _vm->_screen->getFrontBuffer();
surf.pitch = 320;
- surf.bytesPerPixel = 1;
surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128];
@@ -295,7 +293,6 @@ void intro_v3d::introInit() {
surf.h = 200;
surf.pixels = _vm->_screen->getFrontBuffer();
surf.pitch = 320;
- surf.bytesPerPixel = 1;
surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128];
diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h
index d74f7adfe8..96e81f746e 100644
--- a/engines/m4/graphics.h
+++ b/engines/m4/graphics.h
@@ -117,7 +117,6 @@ public:
_ownsData = true;
}
M4Surface(int width_, int height_, byte *srcPixels, int pitch_) {
- bytesPerPixel = 1;
format = Graphics::PixelFormat::createFormatCLUT8();
w = width_;
h = height_;
diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index 7380cfe2ea..820605924c 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -385,7 +385,6 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) {
s.pitch = s.w;
// s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917
assert(s.w <= 16 && s.h <= 17);
- s.bytesPerPixel = 1;
s.format = Graphics::PixelFormat::createFormatCLUT8();
_charset->drawChar(chr, s, 0, 0);
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 876d6bf8ff..0472e16928 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -387,7 +387,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int
vs->backBuf = NULL;
// TODO: This should really rather setup the correct format instead of
// only setting the bytes per pixel.
- vs->bytesPerPixel = vs->format.bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1;
+ vs->format.bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1;
vs->pitch = width * vs->format.bytesPerPixel;
if (_game.version >= 7) {
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index 494b631f14..806d9b27ad 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -187,7 +187,6 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
// Create an encapsulating surface for the data
Graphics::Surface srcImage;
- srcImage.bytesPerPixel = 4;
// TODO: Is the data really in the screen format?
srcImage.format = g_system->getScreenFormat();
srcImage.pitch = _width * 4;
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index c4520704a4..51db2febf9 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -282,7 +282,6 @@ Graphics::Surface GfxSurface::lockSurface() {
result.w = _bounds.width();
result.h = _bounds.height();
result.pitch = src->pitch;
- result.bytesPerPixel = src->bytesPerPixel;
result.format = src->format;
result.pixels = src->getBasePtr(_bounds.left, _bounds.top);
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 55e94f07e7..33919aa381 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -48,26 +48,12 @@ void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) {
error("Surface::drawLine: bytesPerPixel must be 1 or 2");
}
-void Surface::create(uint16 width, uint16 height, uint8 bytesPP) {
- free();
-
- w = width;
- h = height;
- format = PixelFormat();
- format.bytesPerPixel = bytesPerPixel = bytesPP;
- pitch = w * bytesPP;
-
- pixels = calloc(width * height, bytesPP);
- assert(pixels);
-}
-
void Surface::create(uint16 width, uint16 height, const PixelFormat &f) {
free();
w = width;
h = height;
format = f;
- bytesPerPixel = format.bytesPerPixel;
pitch = w * format.bytesPerPixel;
pixels = calloc(width * height, format.bytesPerPixel);
@@ -79,12 +65,10 @@ void Surface::free() {
pixels = 0;
w = h = pitch = 0;
format = PixelFormat();
- bytesPerPixel = 0;
}
void Surface::copyFrom(const Surface &surf) {
- create(surf.w, surf.h, surf.format.bytesPerPixel);
- format = surf.format;
+ create(surf.w, surf.h, surf.format);
memcpy(pixels, surf.pixels, h * pitch);
}
diff --git a/graphics/surface.h b/graphics/surface.h
index d25ebffcc5..283577ab5e 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -67,11 +67,6 @@ struct Surface {
void *pixels;
/**
- * How many bytes a single pixel occupies.
- */
- uint8 bytesPerPixel;
-
- /**
* The pixel format of the surface.
*/
PixelFormat format;
@@ -79,7 +74,7 @@ struct Surface {
/**
* Construct a simple Surface object.
*/
- Surface() : w(0), h(0), pitch(0), pixels(0), bytesPerPixel(0), format() {
+ Surface() : w(0), h(0), pitch(0), pixels(0), format() {
}
/**
@@ -112,18 +107,6 @@ struct Surface {
*
* @param width Width of the surface object.
* @param height Height of the surface object.
- * @param bytePP The number of bytes a single pixel uses.
- */
- void create(uint16 width, uint16 height, uint8 bytesPP);
-
- /**
- * Allocate memory for the pixel data of the surface.
- *
- * Note that you are responsible for calling free yourself.
- * @see free
- *
- * @param width Width of the surface object.
- * @param height Height of the surface object.
* @param format The pixel format the surface should use.
*/
void create(uint16 width, uint16 height, const PixelFormat &format);
diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
index bd907baf84..b68e10b2c3 100644
--- a/video/coktel_decoder.cpp
+++ b/video/coktel_decoder.cpp
@@ -96,7 +96,6 @@ void CoktelDecoder::setSurfaceMemory(void *mem, uint16 width, uint16 height, uin
_surface.h = height;
_surface.pitch = width * bpp;
_surface.pixels = mem;
- _surface.bytesPerPixel = bpp;
// TODO: Check whether it is fine to assume we want the setup PixelFormat.
_surface.format = getPixelFormat();
@@ -140,7 +139,6 @@ void CoktelDecoder::freeSurface() {
_surface.h = 0;
_surface.pitch = 0;
_surface.pixels = 0;
- _surface.bytesPerPixel = 0;
_surface.format = Graphics::PixelFormat();
} else
_surface.free();
@@ -1813,7 +1811,6 @@ bool VMDDecoder::assessVideoProperties() {
_8bppSurface[i].h = _height;
_8bppSurface[i].pitch = _width * _bytesPerPixel;
_8bppSurface[i].pixels = _videoBuffer[i];
- _8bppSurface[i].bytesPerPixel = 1;
_8bppSurface[i].format = Graphics::PixelFormat::createFormatCLUT8();
}
}
diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp
index 44b12c036e..2e864fd3d6 100644
--- a/video/dxa_decoder.cpp
+++ b/video/dxa_decoder.cpp
@@ -101,7 +101,6 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
}
_surface = new Graphics::Surface();
- _surface->bytesPerPixel = 1;
_surface->format = Graphics::PixelFormat::createFormatCLUT8();
debug(2, "flags 0x0%x framesCount %d width %d height %d rate %d", flags, getFrameCount(), getWidth(), getHeight(), getFrameRate().toInt());