aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorKari Salminen2009-03-27 19:11:00 +0000
committerKari Salminen2009-03-27 19:11:00 +0000
commitf7da5230e31ad91d6eb5a289c7218c6172e570fb (patch)
treef3c99fc870aed350a2afa4298cfad04c0e929e48 /engines
parent32495abc384d043d6717e55053aac17e2a746a46 (diff)
downloadscummvm-rg350-f7da5230e31ad91d6eb5a289c7218c6172e570fb.tar.gz
scummvm-rg350-f7da5230e31ad91d6eb5a289c7218c6172e570fb.tar.bz2
scummvm-rg350-f7da5230e31ad91d6eb5a289c7218c6172e570fb.zip
Cine::Palette: Add setGlobalOSystemPalette-method for setting the global OSystem's palette from the Palette object's internal representation.
svn-id: r39709
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/pal.cpp7
-rw-r--r--engines/cine/pal.h3
2 files changed, 10 insertions, 0 deletions
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);