aboutsummaryrefslogtreecommitdiff
path: root/graphics/surface.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2011-04-17 21:27:34 +0200
committerJohannes Schickel2011-04-17 21:27:34 +0200
commitda734a4af024a72ee155bc25d6e45f994de6b060 (patch)
treec2ca3d8215cc8b38834e1a42e9f788d4fabce32b /graphics/surface.cpp
parent877004dbdd967d2f57d494b1aaa1cb55aae0fd52 (diff)
downloadscummvm-rg350-da734a4af024a72ee155bc25d6e45f994de6b060.tar.gz
scummvm-rg350-da734a4af024a72ee155bc25d6e45f994de6b060.tar.bz2
scummvm-rg350-da734a4af024a72ee155bc25d6e45f994de6b060.zip
ALL/GRAPHICS: Remove Surface::bytesPerPixel.
Diffstat (limited to 'graphics/surface.cpp')
-rw-r--r--graphics/surface.cpp18
1 files changed, 1 insertions, 17 deletions
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);
}