From f7da5230e31ad91d6eb5a289c7218c6172e570fb Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Fri, 27 Mar 2009 19:11:00 +0000 Subject: Cine::Palette: Add setGlobalOSystemPalette-method for setting the global OSystem's palette from the Palette object's internal representation. svn-id: r39709 --- engines/cine/pal.cpp | 7 +++++++ engines/cine/pal.h | 3 +++ 2 files changed, 10 insertions(+) (limited to 'engines') diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index f3031c3b60..e02fb3ae9a 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -26,6 +26,7 @@ #include "cine/cine.h" #include "cine/various.h" #include "cine/pal.h" +#include "common/system.h" // For g_system->setPalette namespace Cine { @@ -229,6 +230,12 @@ Graphics::PixelFormat Palette::colorFormat() const { return _format; } +void Palette::setGlobalOSystemPalette() const { + byte buf[256 * 4]; // Allocate space for the largest possible palette + save(buf, sizeof(buf), Cine::kSystemPalFormat, CINE_LITTLE_ENDIAN); + g_system->setPalette(buf, 0, colorCount()); +} + void Palette::setColorFormat(const Graphics::PixelFormat format) { _format = format; diff --git a/engines/cine/pal.h b/engines/cine/pal.h index 3364f55857..8b73771df6 100644 --- a/engines/cine/pal.h +++ b/engines/cine/pal.h @@ -140,6 +140,9 @@ public: /*! \brief The original color format in which this palette was loaded. */ Graphics::PixelFormat colorFormat() const; + /*! \brief Sets current palette to global OSystem's palette using g_system->setPalette. */ + void setGlobalOSystemPalette() const; + private: void setColorFormat(const Graphics::PixelFormat format); void setEndianType(const EndianType endian); -- cgit v1.2.3