diff options
Diffstat (limited to 'graphics/surface.h')
-rw-r--r-- | graphics/surface.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/graphics/surface.h b/graphics/surface.h index 92c7b7e899..2a0f71955a 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -17,9 +17,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ */ #ifndef GRAPHICS_SURFACE_H @@ -31,6 +28,8 @@ namespace Common { struct Rect; } +#include "graphics/pixelformat.h" + namespace Graphics { /** @@ -68,14 +67,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() { } /** @@ -86,7 +85,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; } /** @@ -97,7 +96,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; } /** @@ -108,9 +107,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 |