From 3e8ed4eafcfe3fd8198c65b0838022c1dd32eea8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 23 Nov 2018 15:34:34 -0800 Subject: GRAPHICS: Add convertToInPlace method to ManagedSurface --- graphics/managed_surface.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'graphics') diff --git a/graphics/managed_surface.h b/graphics/managed_surface.h index 422b4610be..a7cf70f857 100644 --- a/graphics/managed_surface.h +++ b/graphics/managed_surface.h @@ -368,9 +368,22 @@ public: addDirtyRect(area); return _innerSurface.getSubArea(area); } + + /** + * 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 + * (that means it might realloc the pixel data). + * + * @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) { + _innerSurface.convertToInPlace(dstFormat, palette); + } }; } // End of namespace Graphics - #endif -- cgit v1.2.3