From 260ec7a430b34f75ec6c30f0f8f444bb7397341e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:42:37 +0200 Subject: GRAPHICS: Add two new methods to change 'pixels' of a Surface. One method is a simpler setter for 'pixels'. The other one can be used to setup a Surface with custom data. --- graphics/surface.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'graphics/surface.cpp') diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 010389c9fa..728c6db12c 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -82,6 +82,14 @@ void Surface::free() { format = PixelFormat(); } +void Surface::init(uint16 width, uint16 height, uint16 newPitch, void *newPixels, const PixelFormat &f) { + w = width; + h = height; + pitch = newPitch; + pixels = newPixels; + format = f; +} + void Surface::copyFrom(const Surface &surf) { create(surf.w, surf.h, surf.format); if (surf.pitch == pitch) { -- cgit v1.2.3