From 4fd3e3d6fe72b6b978fbc5e9e0b5218741d15c83 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 15:17:42 +0200 Subject: GRAPHICS: Add a PixelFormat member to Surface. --- graphics/surface.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'graphics/surface.h') diff --git a/graphics/surface.h b/graphics/surface.h index f9cb6cc474..3cc69fafdd 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -28,6 +28,8 @@ #include "common/scummsys.h" #include "common/rect.h" +#include "graphics/pixelformat.h" + namespace Graphics { /** @@ -69,10 +71,15 @@ struct Surface { */ uint8 bytesPerPixel; + /** + * The pixel format of the surface. + */ + 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), bytesPerPixel(0), format() { } /** @@ -109,6 +116,18 @@ struct Surface { */ 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); + /** * Release the memory used by the pixels memory of this surface. This is the * counterpart to create(). -- cgit v1.2.3