diff options
author | Matthew Hoops | 2011-05-11 00:30:02 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-11 00:30:28 -0400 |
commit | a1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch) | |
tree | 8c51419daa486f1d4833757db4715dadab6c3497 /graphics/surface.h | |
parent | accb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff) | |
parent | 33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff) | |
download | scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2 scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip |
Merge remote branch 'upstream/master' into t7g-ios
Conflicts:
audio/decoders/qdm2.h
common/util.cpp
engines/groovie/music.cpp
engines/groovie/resource.h
video/qt_decoder.cpp
video/qt_decoder.h
Diffstat (limited to 'graphics/surface.h')
-rw-r--r-- | graphics/surface.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/graphics/surface.h b/graphics/surface.h index f9cb6cc474..1b54690aa9 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -26,7 +26,12 @@ #define GRAPHICS_SURFACE_H #include "common/scummsys.h" -#include "common/rect.h" + +namespace Common { +struct Rect; +} + +#include "graphics/pixelformat.h" namespace Graphics { @@ -65,14 +70,14 @@ struct Surface { void *pixels; /** - * How many bytes a single pixel occupies. + * The pixel format of the surface. */ - uint8 bytesPerPixel; + PixelFormat format; /** * Construct a simple Surface object. */ - Surface() : w(0), h(0), pitch(0), pixels(0), bytesPerPixel(0) { + Surface() : w(0), h(0), pitch(0), pixels(0), format() { } /** @@ -83,7 +88,7 @@ struct Surface { * @return Pointer to the pixel. */ inline const void *getBasePtr(int x, int y) const { - return (const byte *)(pixels) + y * pitch + x * bytesPerPixel; + return (const byte *)(pixels) + y * pitch + x * format.bytesPerPixel; } /** @@ -94,7 +99,7 @@ struct Surface { * @return Pointer to the pixel. */ inline void *getBasePtr(int x, int y) { - return static_cast<byte *>(pixels) + y * pitch + x * bytesPerPixel; + return static_cast<byte *>(pixels) + y * pitch + x * format.bytesPerPixel; } /** @@ -105,9 +110,9 @@ 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. + * @param format The pixel format the surface should use. */ - void create(uint16 width, uint16 height, uint8 bytesPP); + void create(uint16 width, uint16 height, const PixelFormat &format); /** * Release the memory used by the pixels memory of this surface. This is the |