From eeb39592599815875a736fdbef67204c2036e935 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 14 Jul 2012 06:03:04 +0200 Subject: GRAPHICS: Add an in-place Surface PixelFormat conversion. --- graphics/surface.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'graphics/surface.h') diff --git a/graphics/surface.h b/graphics/surface.h index eb8d1ac42e..eaf62f84eb 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -134,6 +134,20 @@ struct Surface { */ void copyFrom(const Surface &surf); + /** + * Convert the data to another pixel format. + * + * This works in-place. This means it will not create an additional buffer + * for the conversion process. The value of pixels might change though. + * + * Note that you should only use this, when you created the Surface data via + * create! Otherwise this function has undefined behavior. + * + * @param dstFormat The desired format + * @param palette The palette (in RGB888), if the source format has a Bpp of 1 + */ + void convertToInPlace(const PixelFormat &dstFormat, const byte *palette = 0); + /** * Convert the data to another pixel format. * -- cgit v1.2.3