[Scummvm-cvs-logs] SF.net SVN: scummvm:[55806] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Feb 7 18:52:39 CET 2011


Revision: 55806
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55806&view=rev
Author:   fingolfin
Date:     2011-02-07 17:52:38 +0000 (Mon, 07 Feb 2011)

Log Message:
-----------
COMMON: OSystem now has a PaletteManager

Modified Paths:
--------------
    scummvm/trunk/backends/graphics/graphics.h
    scummvm/trunk/backends/graphics/opengl/opengl-graphics.h
    scummvm/trunk/backends/graphics/sdl/sdl-graphics.h
    scummvm/trunk/backends/modular-backend.cpp
    scummvm/trunk/backends/modular-backend.h
    scummvm/trunk/backends/platform/android/android.cpp
    scummvm/trunk/backends/platform/dc/dc.h
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
    scummvm/trunk/backends/platform/iphone/osys_main.h
    scummvm/trunk/backends/platform/n64/osys_n64.h
    scummvm/trunk/backends/platform/ps2/systemps2.h
    scummvm/trunk/backends/platform/psp/default_display_client.h
    scummvm/trunk/backends/platform/psp/osys_psp.cpp
    scummvm/trunk/backends/platform/psp/osys_psp.h
    scummvm/trunk/backends/platform/wii/osystem.h
    scummvm/trunk/common/system.cpp
    scummvm/trunk/common/system.h
    scummvm/trunk/engines/agi/graphics.cpp
    scummvm/trunk/engines/agos/animation.cpp
    scummvm/trunk/engines/agos/draw.cpp
    scummvm/trunk/engines/agos/script_s1.cpp
    scummvm/trunk/engines/agos/vga_e2.cpp
    scummvm/trunk/engines/agos/vga_ww.cpp
    scummvm/trunk/engines/cine/pal.cpp
    scummvm/trunk/engines/cine/pal.h
    scummvm/trunk/engines/cruise/gfxModule.cpp
    scummvm/trunk/engines/draci/screen.cpp
    scummvm/trunk/engines/drascula/palette.cpp
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/video.cpp
    scummvm/trunk/engines/groovie/debug.cpp
    scummvm/trunk/engines/groovie/graphics.cpp
    scummvm/trunk/engines/groovie/roq.cpp
    scummvm/trunk/engines/groovie/vdx.cpp
    scummvm/trunk/engines/hugo/display.cpp
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/screen_lok.cpp
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/lure/screen.cpp
    scummvm/trunk/engines/m4/graphics.cpp
    scummvm/trunk/engines/m4/woodscript.cpp
    scummvm/trunk/engines/made/screen.cpp
    scummvm/trunk/engines/mohawk/graphics.cpp
    scummvm/trunk/engines/mohawk/livingbooks.cpp
    scummvm/trunk/engines/mohawk/view.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/queen/display.cpp
    scummvm/trunk/engines/saga/gfx.cpp
    scummvm/trunk/engines/sci/graphics/screen.cpp
    scummvm/trunk/engines/sci/graphics/transitions.cpp
    scummvm/trunk/engines/scumm/he/cup_player_he.cpp
    scummvm/trunk/engines/scumm/he/palette_he.cpp
    scummvm/trunk/engines/scumm/palette.cpp
    scummvm/trunk/engines/scumm/smush/smush_player.cpp
    scummvm/trunk/engines/sky/screen.cpp
    scummvm/trunk/engines/sword1/animation.cpp
    scummvm/trunk/engines/sword1/control.cpp
    scummvm/trunk/engines/sword1/screen.cpp
    scummvm/trunk/engines/sword2/palette.cpp
    scummvm/trunk/engines/teenagent/scene.cpp
    scummvm/trunk/engines/teenagent/teenagent.cpp
    scummvm/trunk/engines/testbed/graphics.cpp
    scummvm/trunk/engines/tinsel/palette.cpp
    scummvm/trunk/engines/toon/toon.cpp
    scummvm/trunk/engines/touche/touche.cpp
    scummvm/trunk/engines/tucker/locations.cpp
    scummvm/trunk/engines/tucker/sequences.cpp
    scummvm/trunk/engines/tucker/tucker.cpp
    scummvm/trunk/graphics/scaler/thumbnail_intern.cpp
    scummvm/trunk/sound/softsynth/mt32.cpp
    scummvm/trunk/video/video_decoder.cpp

Added Paths:
-----------
    scummvm/trunk/backends/graphics/default-palette.h
    scummvm/trunk/graphics/palette.h

Added: scummvm/trunk/backends/graphics/default-palette.h
===================================================================
--- scummvm/trunk/backends/graphics/default-palette.h	                        (rev 0)
+++ scummvm/trunk/backends/graphics/default-palette.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef BACKENDS_GRAPHICS_DEFAULT_PALETTE_H
+#define BACKENDS_GRAPHICS_DEFAULT_PALETTE_H
+
+#include "graphics/palette.h"
+
+/**
+ * This is a default implementation of the PaletteManager interface
+ * which ensures that grabPalette works as specified. Of course
+ * it is still necessary to provide code that actually updates
+ * the (possibly emulated) "hardware" palette of the backend.
+ * For this purpose, implement the abstract setPaletteIntern
+ * method.
+ */
+class DefaultPaletteManager : public PaletteManager {
+protected:
+	byte _palette[4 * 256];
+
+	/**
+	 * Subclasses should only implement this method and none of the others.
+	 * Its semantics are like that of setPalette, only that it does not need
+	 * to worry about making it possible to query the palette values once they
+	 * have been set.
+	 */
+	virtual void setPaletteIntern(const byte *colors, uint start, uint num) = 0;
+
+public:
+	void setPalette(const byte *colors, uint start, uint num) {
+		assert(start + num <= 256);
+		memcpy(_palette + 4 * start, colors, 4 * num);
+		setPaletteIntern(colors, start, num);
+	}
+	void grabPalette(byte *colors, uint start, uint num) {
+		assert(start + num <= 256);
+		memcpy(colors, _palette + 4 * start, 4 * num);
+	}
+};
+
+#endif


Property changes on: scummvm/trunk/backends/graphics/default-palette.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/backends/graphics/graphics.h
===================================================================
--- scummvm/trunk/backends/graphics/graphics.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/graphics/graphics.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -30,11 +30,13 @@
 #include "common/noncopyable.h"
 #include "common/keyboard.h"
 
+#include "graphics/palette.h"
+
 /**
  * Abstract class for graphics manager. Subclasses
  * implement the real functionality.
  */
-class GraphicsManager : Common::NonCopyable {
+class GraphicsManager : public PaletteManager {
 public:
 	virtual ~GraphicsManager() {}
 

Modified: scummvm/trunk/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/trunk/backends/graphics/opengl/opengl-graphics.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/graphics/opengl/opengl-graphics.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -81,8 +81,12 @@
 
 	virtual int16 getHeight();
 	virtual int16 getWidth();
+protected:
+	// PaletteManager API
 	virtual void setPalette(const byte *colors, uint start, uint num);
 	virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	virtual Graphics::Surface *lockScreen();
 	virtual void unlockScreen();

Modified: scummvm/trunk/backends/graphics/sdl/sdl-graphics.h
===================================================================
--- scummvm/trunk/backends/graphics/sdl/sdl-graphics.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/graphics/sdl/sdl-graphics.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -101,8 +101,13 @@
 	
 	virtual int16 getHeight();
 	virtual int16 getWidth();
+
+protected:
+	// PaletteManager API
 	virtual void setPalette(const byte *colors, uint start, uint num);
 	virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	virtual Graphics::Surface *lockScreen();
 	virtual void unlockScreen();

Modified: scummvm/trunk/backends/modular-backend.cpp
===================================================================
--- scummvm/trunk/backends/modular-backend.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/modular-backend.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -132,14 +132,10 @@
 	return _graphicsManager->getWidth();
 }
 
-void ModularBackend::setPalette(const byte *colors, uint start, uint num) {
-	_graphicsManager->setPalette(colors, start, num);
+PaletteManager *ModularBackend::getPaletteManager() {
+	return _graphicsManager;
 }
 
-void ModularBackend::grabPalette(byte *colors, uint start, uint num) {
-	_graphicsManager->grabPalette(colors, start, num);
-}
-
 void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
 	_graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h);
 }

Modified: scummvm/trunk/backends/modular-backend.h
===================================================================
--- scummvm/trunk/backends/modular-backend.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/modular-backend.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -87,8 +87,7 @@
 
 	virtual int16 getHeight();
 	virtual int16 getWidth();
-	virtual void setPalette(const byte *colors, uint start, uint num);
-	virtual void grabPalette(byte *colors, uint start, uint num);
+	virtual PaletteManager *getPaletteManager();
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	virtual Graphics::Surface *lockScreen();
 	virtual void unlockScreen();

Modified: scummvm/trunk/backends/platform/android/android.cpp
===================================================================
--- scummvm/trunk/backends/platform/android/android.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/android/android.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -153,7 +153,7 @@
 #define CHECK_GL_ERROR() do {} while (false)
 #endif
 
-class OSystem_Android : public BaseBackend {
+class OSystem_Android : public BaseBackend, public PaletteManager {
 private:
 	jobject _back_ptr;	// back pointer to (java) peer instance
 	jmethodID MID_displayMessageOnOSD;
@@ -238,8 +238,14 @@
 	virtual int getScreenChangeID() const { return _screen_changeid; }
 	virtual int16 getHeight();
 	virtual int16 getWidth();
+
+	virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+	// PaletteManager API
 	virtual void setPalette(const byte *colors, uint start, uint num);
 	virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	virtual void updateScreen();
 	virtual Graphics::Surface *lockScreen();

Modified: scummvm/trunk/backends/platform/dc/dc.h
===================================================================
--- scummvm/trunk/backends/platform/dc/dc.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/dc/dc.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -69,7 +69,7 @@
   void updateCD();
 };
 
-class OSystem_Dreamcast : private DCHardware, public BaseBackend, public FilesystemFactory {
+class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory {
 
  public:
   OSystem_Dreamcast();
@@ -98,9 +98,14 @@
   int getGraphicsMode() const;
 
   // Set colors of the palette
+  PaletteManager *getPaletteManager() { return this; }
+protected:
+	// PaletteManager API
   void setPalette(const byte *colors, uint start, uint num);
   void grabPalette(byte *colors, uint start, uint num);
 
+public:
+
   // Determine the pixel format currently in use for screen rendering.
   Graphics::PixelFormat getScreenFormat() const;
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -37,7 +37,7 @@
 #include "graphics/surface.h"
 #include "graphics/colormasks.h"
 
-class OSystem_DS : public BaseBackend {
+class OSystem_DS : public BaseBackend, public PaletteManager {
 protected:
 
 	int eventNum;
@@ -92,8 +92,14 @@
 	virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
 	virtual int16 getHeight();
 	virtual int16 getWidth();
+
+	virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+	// PaletteManager API
 	virtual void setPalette(const byte *colors, uint start, uint num);
-	virtual void grabPalette(unsigned char *colors, uint start, uint num);
+	virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
 	void restoreHardwarePalette();
 
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);

Modified: scummvm/trunk/backends/platform/iphone/osys_main.h
===================================================================
--- scummvm/trunk/backends/platform/iphone/osys_main.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/iphone/osys_main.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -51,7 +51,7 @@
     AudioStreamBasicDescription dataFormat;
 } AQCallbackStruct;
 
-class OSystem_IPHONE : public BaseBackend {
+class OSystem_IPHONE : public BaseBackend, public PaletteManager {
 protected:
 
 	static const OSystem::GraphicsMode s_supportedGraphicsModes[];
@@ -132,8 +132,14 @@
 	virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
 	virtual int16 getHeight();
 	virtual int16 getWidth();
+
+	virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+	// PaletteManager API
 	virtual void setPalette(const byte *colors, uint start, uint num);
 	virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	virtual void updateScreen();
 	virtual Graphics::Surface *lockScreen();

Modified: scummvm/trunk/backends/platform/n64/osys_n64.h
===================================================================
--- scummvm/trunk/backends/platform/n64/osys_n64.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/n64/osys_n64.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -75,7 +75,7 @@
 	OVERS_MPAL_340X240
 };
 
-class OSystem_N64 : public BaseBackend {
+class OSystem_N64 : public BaseBackend, public PaletteManager {
 protected:
 	Common::SaveFileManager *_savefile;
 	Audio::MixerImpl *_mixer;
@@ -158,8 +158,14 @@
 	virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
 	virtual int16 getHeight();
 	virtual int16 getWidth();
+
+	virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+	// PaletteManager API
 	virtual void setPalette(const byte *colors, uint start, uint num);
 	virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	virtual void updateScreen();
 	virtual Graphics::Surface *lockScreen();

Modified: scummvm/trunk/backends/platform/ps2/systemps2.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/ps2/systemps2.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -54,7 +54,7 @@
 	class MixerImpl;
 };
 
-class OSystem_PS2 : public BaseBackend {
+class OSystem_PS2 : public BaseBackend, public PaletteManager {
 public:
 	OSystem_PS2(const char *elfPath);
 	virtual ~OSystem_PS2(void);
@@ -64,10 +64,16 @@
 
 	virtual int16 getHeight(void);
 	virtual int16 getWidth(void);
+
+	virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+	// PaletteManager API
 	virtual void setPalette(const byte *colors, uint start, uint num);
+	virtual void grabPalette(byte *colors, uint start, uint num);
+public:
+
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	virtual void setShakePos(int shakeOffset);
-	virtual void grabPalette(byte *colors, uint start, uint num);
 	virtual bool grabRawScreen(Graphics::Surface *surf);
 	virtual Graphics::Surface *lockScreen();
 	virtual void unlockScreen();

Modified: scummvm/trunk/backends/platform/psp/default_display_client.h
===================================================================
--- scummvm/trunk/backends/platform/psp/default_display_client.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/psp/default_display_client.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -69,7 +69,7 @@
 class Overlay : public DefaultDisplayClient {
 public:
 	Overlay() {}
-	~Overlay() { }
+	~Overlay() {}
 
 	void init();
 	bool allocate();

Modified: scummvm/trunk/backends/platform/psp/osys_psp.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/psp/osys_psp.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -273,11 +273,11 @@
 }
 
 int16 OSystem_PSP::getOverlayWidth() {
-	return (int16) _overlay.getWidth();
+	return (int16)_overlay.getWidth();
 }
 
 int16 OSystem_PSP::getOverlayHeight() {
-	return (int16) _overlay.getHeight();
+	return (int16)_overlay.getHeight();
 }
 
 void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) {

Modified: scummvm/trunk/backends/platform/psp/osys_psp.h
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/psp/osys_psp.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -44,7 +44,7 @@
 #include "backends/timer/psp/timer.h"
 #include "backends/platform/psp/thread.h"
 
-class OSystem_PSP : public BaseBackend {
+class OSystem_PSP : public BaseBackend, public PaletteManager {
 private:
 
 	Common::SaveFileManager *_savefile;
@@ -94,8 +94,12 @@
 	int16 getHeight();
 
 	// Palette related
+	PaletteManager *getPaletteManager() { return this; }
+protected:
+	// PaletteManager API
 	void setPalette(const byte *colors, uint start, uint num);
 	void grabPalette(byte *colors, uint start, uint num);
+public:
 	void setCursorPalette(const byte *colors, uint start, uint num);
 	void disableCursorPalette(bool disable);
 

Modified: scummvm/trunk/backends/platform/wii/osystem.h
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/backends/platform/wii/osystem.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -54,7 +54,7 @@
 }
 #endif
 
-class OSystem_Wii : public BaseBackend {
+class OSystem_Wii : public BaseBackend, public PaletteManager {
 private:
 	s64 _startup_time;
 
@@ -164,8 +164,12 @@
 							const Graphics::PixelFormat *format);
 	virtual int16 getWidth();
 	virtual int16 getHeight();
+
+	virtual PaletteManager *getPaletteManager() { return this; }
+protected:
 	virtual void setPalette(const byte *colors, uint start, uint num);
 	virtual void grabPalette(byte *colors, uint start, uint num);
+public:
 	virtual void setCursorPalette(const byte *colors, uint start, uint num);
 	virtual void disableCursorPalette(bool disable);
 	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,

Modified: scummvm/trunk/common/system.cpp
===================================================================
--- scummvm/trunk/common/system.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/common/system.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -93,4 +93,3 @@
 Common::String OSystem::getSystemLanguage() const {
 	return "en_US";
 }
-

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/common/system.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -31,6 +31,7 @@
 #include "common/rect.h"
 #include "common/list.h" // For OSystem::getSupportedFormats()
 
+#include "graphics/palette.h" // for PaletteManager
 #include "graphics/pixelformat.h"
 
 namespace Audio {
@@ -54,6 +55,7 @@
 
 class AudioCDManager;
 class FilesystemFactory;
+class PaletteManager;
 
 /**
  * A structure describing time and date. This is a clone of struct tm
@@ -517,68 +519,12 @@
 	virtual int16 getWidth() = 0;
 
 	/**
-	 * Replace the specified range of the palette with new colors.
-	 * The palette entries from 'start' till (start+num-1) will be replaced - so
-	 * a full palette update is accomplished via start=0, num=256.
-	 *
-	 * The palette data is specified in interleaved RGBA format. That is, the
-	 * first byte of the memory block 'colors' points at is the red component
-	 * of the first new color; the second byte the green component of the first
-	 * new color; the third byte the blue component, the last byte to the alpha
-	 * (transparency) value. Then the second color starts, and so on. So memory
-	 * looks like this: R1-G1-B1-A1-R2-G2-B2-A2-R3-...
-	 *
-	 * @param colors	the new palette data, in interleaved RGBA format
-	 * @param start		the first palette entry to be updated
-	 * @param num		the number of palette entries to be updated
-	 *
-	 * @note It is an error if start+num exceeds 256, behaviour is undefined
-	 *       in that case (the backend may ignore it silently or assert).
-	 * @note It is an error if this function gets called when the pixel format
-	 *       in use (the return value of getScreenFormat) has more than one
-	 *       byte per pixel.
-	 * @note The alpha value is not actually used, and future revisions of this
-	 *       API are probably going to remove it.
-	 *
-	 * @see getScreenFormat
+	 * Return the palette manager singleton. For more information, refer
+	 * to the PaletteManager documentation.
 	 */
-	virtual void setPalette(const byte *colors, uint start, uint num) = 0;
+	virtual PaletteManager *getPaletteManager() = 0;
 
 	/**
-	 * Grabs a specified part of the currently active palette.
-	 * The format is the same as for setPalette.
-	 *
-	 * This should return exactly the same RGB data as was setup via previous
-	 * setPalette calls.
-	 *
-	 * For example, for every valid value of start and num of the following
-	 * code:
-	 *
-	 * byte origPal[num*4];
-	 * // Setup origPal's data however you like
-	 * g_system->setPalette(origPal, start, num);
-	 * byte obtainedPal[num*4];
-	 * g_system->grabPalette(obtainedPal, start, num);
-	 *
-	 * the following should be true:
-	 *
-	 * For each i < num : memcmp(&origPal[i*4], &obtainedPal[i*4], 3) == 0
-	 * (i is an uint here)
-	 *
-	 * @see setPalette
-	 * @param colors	the palette data, in interleaved RGBA format
-	 * @param start		the first platte entry to be read
-	 * @param num		the number of palette entries to be read
-	 *
-	 * @note It is an error if this function gets called when the pixel format
-	 *       in use (the return value of getScreenFormat) has more than one
-	 *       byte per pixel.
-	 *
-	 * @see getScreenFormat
-	 */
-	virtual void grabPalette(byte *colors, uint start, uint num) = 0;
-
-	/**
 	 * Blit a bitmap to the virtual screen.
 	 * The real screen will not immediately be updated to reflect the changes.
 	 * Client code has to to call updateScreen to ensure any changes are
@@ -1079,7 +1025,7 @@
 	 *
 	 * For information about POSIX locales read here:
 	 * http://en.wikipedia.org/wiki/Locale#POSIX-type_platforms
-	 * 
+	 *
 	 * The default implementation returns "en_US".
 	 *
 	 * @return locale of the system

Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/agi/graphics.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -806,7 +806,7 @@
 }
 
 void GfxMgr::gfxSetPalette() {
-	g_system->setPalette(_palette, 0, 256);
+	g_system->getPaletteManager()->setPalette(_palette, 0, 256);
 }
 
 //Gets AGIPAL Data

Modified: scummvm/trunk/engines/agos/animation.cpp
===================================================================
--- scummvm/trunk/engines/agos/animation.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/agos/animation.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -90,7 +90,7 @@
 		uint8 palette[1024];
 		memset(palette, 0, sizeof(palette));
 		_vm->clearSurfaces();
-		_vm->_system->setPalette(palette, 0, 256);
+		_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
 	}
 
 	_vm->fillBackGroundFromBack();

Modified: scummvm/trunk/engines/agos/draw.cpp
===================================================================
--- scummvm/trunk/engines/agos/draw.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/agos/draw.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -781,7 +781,7 @@
 		_paletteFlag = 0;
 		if (memcmp(_displayPalette, _currentPalette, 1024)) {
 			memcpy(_currentPalette, _displayPalette, 1024);
-			_system->setPalette(_displayPalette, 0, 256);
+			_system->getPaletteManager()->setPalette(_displayPalette, 0, 256);
 		}
 	}
 
@@ -861,7 +861,7 @@
 	} else {
 		_paletteFlag = false;
 		memcpy(_currentPalette, _displayPalette, 1024);
-		_system->setPalette(_displayPalette, 0, _fastFadeInFlag);
+		_system->getPaletteManager()->setPalette(_displayPalette, 0, _fastFadeInFlag);
 		_fastFadeInFlag = 0;
 	}
 }
@@ -889,7 +889,7 @@
 			src += 4;
 			dst += 4;
 		}
-		_system->setPalette(_currentPalette, 0, _fastFadeCount);
+		_system->getPaletteManager()->setPalette(_currentPalette, 0, _fastFadeCount);
 		delay(5);
 	}
 	_fastFadeInFlag = 0;

Modified: scummvm/trunk/engines/agos/script_s1.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_s1.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/agos/script_s1.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -580,7 +580,7 @@
 		paletteFadeOut(_currentPalette, 32, 8);
 		paletteFadeOut(_currentPalette + 4 * 48, 144, 8);
 		paletteFadeOut(_currentPalette + 4 * 208, 48, 8);
-		_system->setPalette(_currentPalette, 0, 256);
+		_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
 		delay(5);
 	}
 

Modified: scummvm/trunk/engines/agos/vga_e2.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_e2.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/agos/vga_e2.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -373,7 +373,7 @@
 			srcPal += 3;
 			dstPal += 4;
 		}
-		_system->setPalette(_currentPalette, 0, 256);
+		_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
 		delay(5);
 	}
 }
@@ -395,7 +395,7 @@
 
 void AGOSEngine::vc57_blackPalette() {
 	memset(_currentPalette, 0, sizeof(_currentPalette));
-	_system->setPalette(_currentPalette, 0, 256);
+	_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
 }
 
 void AGOSEngine::vc58_checkCodeWheel() {

Modified: scummvm/trunk/engines/agos/vga_ww.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_ww.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/agos/vga_ww.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -224,7 +224,7 @@
 
 		for (i = fadeCount; i != 0; --i) {
 			paletteFadeOut(_currentPalette, _fastFadeCount, fadeSize);
-			_system->setPalette(_currentPalette, 0, _fastFadeCount);
+			_system->getPaletteManager()->setPalette(_currentPalette, 0, _fastFadeCount);
 			delay(5);
 		}
 

Modified: scummvm/trunk/engines/cine/pal.cpp
===================================================================
--- scummvm/trunk/engines/cine/pal.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/cine/pal.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -26,7 +26,7 @@
 #include "cine/cine.h"
 #include "cine/various.h"
 #include "cine/pal.h"
-#include "common/system.h" // For g_system->setPalette
+#include "common/system.h" // For g_system->getPaletteManager()->setPalette
 
 namespace Cine {
 
@@ -196,9 +196,9 @@
 		for (uint i = 0; i < 16 * 4; ++i)
 			buf[16 * 4 + i] = buf[i] >> 1;
 
-		g_system->setPalette(buf, 0, colorCount() * 2);
+		g_system->getPaletteManager()->setPalette(buf, 0, colorCount() * 2);
 	} else {
-		g_system->setPalette(buf, 0, colorCount());
+		g_system->getPaletteManager()->setPalette(buf, 0, colorCount());
 	}
 }
 

Modified: scummvm/trunk/engines/cine/pal.h
===================================================================
--- scummvm/trunk/engines/cine/pal.h	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/cine/pal.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -159,7 +159,7 @@
 	/** The original color format in which this palette was loaded. */
 	const Graphics::PixelFormat &colorFormat() const;
 
-	/** Sets current palette to global OSystem's palette using g_system->setPalette. */
+	/** Sets current palette to global OSystem's palette using g_system->getPaletteManager()->setPalette. */
 	void setGlobalOSystemPalette() const;
 
 	/** Get the color at the given palette index. */

Modified: scummvm/trunk/engines/cruise/gfxModule.cpp
===================================================================
--- scummvm/trunk/engines/cruise/gfxModule.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/cruise/gfxModule.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -282,7 +282,7 @@
 			paletteRGBA[i * 4 + 2] = lpalette[i].B;
 			paletteRGBA[i * 4 + 3] = 0xFF;
 		}
-		g_system->setPalette(paletteRGBA + palDirtyMin*4, palDirtyMin, palDirtyMax - palDirtyMin + 1);
+		g_system->getPaletteManager()->setPalette(paletteRGBA + palDirtyMin*4, palDirtyMin, palDirtyMax - palDirtyMin + 1);
 		palDirtyMin = 256;
 		palDirtyMax = -1;
 	}

Modified: scummvm/trunk/engines/draci/screen.cpp
===================================================================
--- scummvm/trunk/engines/draci/screen.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/draci/screen.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -75,7 +75,7 @@
 		_palette[i] <<= 2;
 	}
 
-	_vm->_system->setPalette(_palette, start, num);
+	_vm->_system->getPaletteManager()->setPalette(_palette, start, num);
 }
 
 void Screen::interpolatePalettes(const byte *first, const byte *second, uint16 start, uint16 num, int index, int number) {
@@ -97,7 +97,7 @@
 		_palette[i] <<= 2;
 	}
 
-	_vm->_system->setPalette(_palette, start, num);
+	_vm->_system->getPaletteManager()->setPalette(_palette, start, num);
 }
 
 int Screen::interpolate(int first, int second, int index, int number) {

Modified: scummvm/trunk/engines/drascula/palette.cpp
===================================================================
--- scummvm/trunk/engines/drascula/palette.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/drascula/palette.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -74,7 +74,7 @@
 		pal[i * 4 + 2] = PalBuf[i * 3 + 2] * 4;
 		pal[i * 4 + 3] = 0;
 	}
-	_system->setPalette(pal, 0, 256);
+	_system->getPaletteManager()->setPalette(pal, 0, 256);
 	_system->updateScreen();
 }
 

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/gob/util.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -325,7 +325,7 @@
 	if (_vm->_global->_setAllPalette) {
 		if (_vm->getPixelFormat().bytesPerPixel == 1) {
 			memset(colors, 0, 1024);
-			g_system->setPalette(colors, 0, 256);
+			g_system->getPaletteManager()->setPalette(colors, 0, 256);
 		}
 
 		return;

Modified: scummvm/trunk/engines/gob/video.cpp
===================================================================
--- scummvm/trunk/engines/gob/video.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/gob/video.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -355,7 +355,7 @@
 	setPalColor(pal, red, green, blue);
 
 	if (_vm->getPixelFormat().bytesPerPixel == 1)
-		g_system->setPalette(pal, index, 1);
+		g_system->getPaletteManager()->setPalette(pal, index, 1);
 }
 
 void Video::setPalette(PalDesc *palDesc) {
@@ -369,7 +369,7 @@
 		setPalColor(pal + i * 4, palDesc->vgaPal[i]);
 
 	if (_vm->getPixelFormat().bytesPerPixel == 1)
-		g_system->setPalette(pal, 0, numcolors);
+		g_system->getPaletteManager()->setPalette(pal, 0, numcolors);
 }
 
 void Video::setFullPalette(PalDesc *palDesc) {
@@ -385,7 +385,7 @@
 		}
 
 		if (_vm->getPixelFormat().bytesPerPixel == 1)
-			g_system->setPalette(pal, 0, 256);
+			g_system->getPaletteManager()->setPalette(pal, 0, 256);
 	} else
 		Video::setPalette(palDesc);
 }

Modified: scummvm/trunk/engines/groovie/debug.cpp
===================================================================
--- scummvm/trunk/engines/groovie/debug.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/groovie/debug.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -138,7 +138,7 @@
 bool Debugger::cmd_dumppal(int argc, const char **argv) {
 	uint16 i;
 	byte palettedump[256 * 4];
-	_vm->_system->grabPalette(palettedump, 0, 256);
+	_vm->_system->getPaletteManager()->grabPalette(palettedump, 0, 256);
 
 	for (i = 0; i < 256; i++) {
 		DebugPrintf("%3d: %3d,%3d,%3d,%3d\n", i, palettedump[(i * 4)], palettedump[(i * 4) + 1], palettedump[(i * 4) + 2], palettedump[(i * 4) + 3]);

Modified: scummvm/trunk/engines/groovie/graphics.cpp
===================================================================
--- scummvm/trunk/engines/groovie/graphics.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/groovie/graphics.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -124,7 +124,7 @@
 	_fadeStartTime = _vm->_system->getMillis();
 
 	// Get the current palette
-	_vm->_system->grabPalette(_paletteFull, 0, 256);
+	_vm->_system->getPaletteManager()->grabPalette(_paletteFull, 0, 256);
 
 	// Set the current fading
 	_fading = 2;
@@ -159,7 +159,7 @@
 	}
 
 	// Set the screen palette
-	_vm->_system->setPalette(newpal, 0, 256);
+	_vm->_system->getPaletteManager()->setPalette(newpal, 0, 256);
 
 	// Request a screen update
 	change();

Modified: scummvm/trunk/engines/groovie/roq.cpp
===================================================================
--- scummvm/trunk/engines/groovie/roq.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/groovie/roq.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -96,7 +96,7 @@
 		}
 #endif // DITHER
 
-		_syst->setPalette(pal, 0, 256);
+		_syst->getPaletteManager()->setPalette(pal, 0, 256);
 	}
 }
 

Modified: scummvm/trunk/engines/groovie/vdx.cpp
===================================================================
--- scummvm/trunk/engines/groovie/vdx.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/groovie/vdx.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -563,7 +563,7 @@
 		palBuf[(i * 4) + 2] = palette[(i * 3) + 2];
 		palBuf[(i * 4) + 3] = 0;
 	}
-	_syst->setPalette(palBuf, 0, 256);
+	_syst->getPaletteManager()->setPalette(palBuf, 0, 256);
 }
 
 } // End of Groovie namespace

Modified: scummvm/trunk/engines/hugo/display.cpp
===================================================================
--- scummvm/trunk/engines/hugo/display.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/hugo/display.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -79,7 +79,7 @@
 void Screen::createPal() {
 	debugC(1, kDebugDisplay, "createPal");
 
-	g_system->setPalette(_mainPalette, 0, _paletteSize / 4);
+	g_system->getPaletteManager()->setPalette(_mainPalette, 0, _paletteSize / 4);
 }
 
 void Screen::setCursorPal() {
@@ -146,7 +146,7 @@
 	pal[2] = _curPalette[4 * oldIndex + 2] = _mainPalette[newIndex * 4 + 2];
 	pal[3] = _curPalette[4 * oldIndex + 3] = _mainPalette[newIndex * 4 + 3];
 
-	g_system->setPalette(pal, oldIndex, 1);
+	g_system->getPaletteManager()->setPalette(pal, oldIndex, 1);
 }
 
 /**
@@ -175,7 +175,7 @@
 		pal[1] = _curPalette[i * 4 + 1];
 		pal[2] = _curPalette[i * 4 + 2];
 		pal[3] = _curPalette[i * 4 + 3];
-		g_system->setPalette(pal, i, 1);
+		g_system->getPaletteManager()->setPalette(pal, i, 1);
 	}
 }
 

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/kyra/screen.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -145,7 +145,7 @@
 			palette[i * 4 + 2] = ((i >> 0) & 1) * 0xFF;
 			palette[i * 4 + 3] = 0;
 
-			_system->setPalette(palette, 16, 8);
+			_system->getPaletteManager()->setPalette(palette, 16, 8);
 		}
 	}
 
@@ -181,7 +181,7 @@
 
 void Screen::setResolution() {
 	byte palette[4*256];
-	_system->grabPalette(palette, 0, 256);
+	_system->getPaletteManager()->grabPalette(palette, 0, 256);
 
 	int width = 320, height = 200;
 	bool defaultTo1xScaler = false;
@@ -203,7 +203,7 @@
 
 	initGraphics(width, height, defaultTo1xScaler);
 
-	_system->setPalette(palette, 0, 256);
+	_system->getPaletteManager()->setPalette(palette, 0, 256);
 }
 
 void Screen::updateScreen() {
@@ -711,7 +711,7 @@
 	}
 
 	_paletteChanged = true;
-	_system->setPalette(screenPal, 0, pal.getNumColors());
+	_system->getPaletteManager()->setPalette(screenPal, 0, pal.getNumColors());
 }
 
 void Screen::enableInterfacePalette(bool e) {
@@ -747,7 +747,7 @@
 	}
 
 	_paletteChanged = true;
-	_system->setPalette(screenPal, 32, pal.getNumColors());
+	_system->getPaletteManager()->setPalette(screenPal, 32, pal.getNumColors());
 }
 
 void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {

Modified: scummvm/trunk/engines/kyra/screen_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lok.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/kyra/screen_lok.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -455,7 +455,7 @@
 		palette[i * 4 + 3] = 0;
 	}
 
-	_system->setPalette(palette, 0, 16);
+	_system->getPaletteManager()->setPalette(palette, 0, 16);
 }
 
 } // End of namespace Kyra

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -801,7 +801,7 @@
 	ci[2] = (d[2] << 2) | (d[2] & 3);
 	ci[3] = 0;
 
-	_system->setPalette(ci, dstColorIndex, 1);
+	_system->getPaletteManager()->setPalette(ci, dstColorIndex, 1);
 }
 
 bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTicks, uint32 totalTicks) {

Modified: scummvm/trunk/engines/lure/screen.cpp
===================================================================
--- scummvm/trunk/engines/lure/screen.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/lure/screen.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -44,7 +44,7 @@
 		_palette(new Palette(GAME_PALETTE_RESOURCE_ID, RGB64)) {
 	int_disk = this;
 	_screen->empty();
-	_system.setPalette(_palette->data(), 0, GAME_COLOURS);
+	_system.getPaletteManager()->setPalette(_palette->data(), 0, GAME_COLOURS);
 }
 
 Screen::~Screen() {
@@ -57,13 +57,13 @@
 
 void Screen::setPaletteEmpty(int numEntries) {
 	Palette emptyPalette(numEntries, NULL, RGB64);
-	_system.setPalette(emptyPalette.data(), 0, numEntries);
+	_system.getPaletteManager()->setPalette(emptyPalette.data(), 0, numEntries);
 	_palette->copyFrom(&emptyPalette);
 /*
 	delete _palette;
 	_palette = new Palette();
 
-	_system.setPalette(_palette->data(), 0, numEntries);
+	_system.getPaletteManager()->setPalette(_palette->data(), 0, numEntries);
 */
 	_system.updateScreen();
 }
@@ -73,7 +73,7 @@
 
 void Screen::setPalette(Palette *p) {
 	_palette->copyFrom(p);
-	_system.setPalette(_palette->data(), 0, GAME_COLOURS);
+	_system.getPaletteManager()->setPalette(_palette->data(), 0, GAME_COLOURS);
 	_system.updateScreen();
 }
 
@@ -82,7 +82,7 @@
 
 void Screen::setPalette(Palette *p, uint16 start, uint16 num) {
 	_palette->palette()->copyFrom(p->palette(), start * 4, start * 4, num * 4);
-	_system.setPalette(_palette->data(), start, num);
+	_system.getPaletteManager()->setPalette(_palette->data(), start, num);
 	_system.updateScreen();
 }
 
@@ -114,7 +114,7 @@
 		}
 
 		if (changed) {
-			_system.setPalette(_palette->data(), 0, p->numEntries());
+			_system.getPaletteManager()->setPalette(_palette->data(), 0, p->numEntries());
 			_system.updateScreen();
 			_system.delayMillis(20);
 			while (events.pollEvent())
@@ -147,7 +147,7 @@
 		}
 
 		if (changed) {
-			_system.setPalette(_palette->data(), 0, numEntries);
+			_system.getPaletteManager()->setPalette(_palette->data(), 0, numEntries);
 			_system.updateScreen();
 			_system.delayMillis(20);
 			while (events.pollEvent())

Modified: scummvm/trunk/engines/m4/graphics.cpp
===================================================================
--- scummvm/trunk/engines/m4/graphics.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/m4/graphics.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -1031,17 +1031,17 @@
 }
 
 void Palette::setPalette(const byte *colors, uint start, uint num) {
-	g_system->setPalette(colors, start, num);
+	g_system->getPaletteManager()->setPalette(colors, start, num);
 	reset();
 }
 
 void Palette::setPalette(const RGB8 *colors, uint start, uint num) {
-	g_system->setPalette((const byte *)colors, start, num);
+	g_system->getPaletteManager()->setPalette((const byte *)colors, start, num);
 	reset();
 }
 
 void Palette::grabPalette(byte *colors, uint start, uint num) {
-	g_system->grabPalette(colors, start, num);
+	g_system->getPaletteManager()->grabPalette(colors, start, num);
 }
 
 void Palette::setEntry(uint index, uint8 r, uint8 g, uint8 b) {
@@ -1050,7 +1050,7 @@
 	c.g = g;
 	c.b = b;
 	c.u = 255;
-	g_system->setPalette((const byte *)&c, index, 1);
+	g_system->getPaletteManager()->setPalette((const byte *)&c, index, 1);
 }
 
 uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) {
@@ -1060,7 +1060,7 @@
 	int Rdiff, Gdiff, Bdiff;
 
 	if (paletteData == NULL) {
-		g_system->grabPalette((byte *)palData, 0, 256);
+		g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256);
 		paletteData = &palData[0];
 	}
 
@@ -1080,7 +1080,7 @@
 
 void Palette::reset() {
 	RGB8 palData[256];
-	g_system->grabPalette((byte *)palData, 0, 256);
+	g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256);
 
 	BLACK = palIndexFromRgb(0, 0, 0, palData);
 	BLUE = palIndexFromRgb(0, 0, 255, palData);
@@ -1260,7 +1260,7 @@
 	RGB8 *data = list->data();
 	byte *palIndexes = list->palIndexes();
 	RGB8 palData[256];
-	g_system->grabPalette((byte *)&palData[0], 0, 256);
+	g_system->getPaletteManager()->grabPalette((byte *)&palData[0], 0, 256);
 	bool paletteChanged = false;
 
 	for (int colIndex = 0; colIndex < list->size(); ++colIndex) {
@@ -1300,7 +1300,7 @@
 	}
 
 	if (paletteChanged) {
-		g_system->setPalette((byte *)&palData[0], 0, 256);
+		g_system->getPaletteManager()->setPalette((byte *)&palData[0], 0, 256);
 		reset();
 	}
 }

Modified: scummvm/trunk/engines/m4/woodscript.cpp
===================================================================
--- scummvm/trunk/engines/m4/woodscript.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/m4/woodscript.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -322,7 +322,7 @@
 	{
 		// FIXME: This should be done when a new palette is set
 		byte palette[1024];
-		g_system->grabPalette(palette, 0, 256);
+		g_system->getPaletteManager()->grabPalette(palette, 0, 256);
 		for (int i = 0; i < 256; i++) {
 			_mainPalette[i].r = palette[i * 4 + 0];
 			_mainPalette[i].g = palette[i * 4 + 1];

Modified: scummvm/trunk/engines/made/screen.cpp
===================================================================
--- scummvm/trunk/engines/made/screen.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/made/screen.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -227,7 +227,7 @@
 		_screenPalette[i * 4 + 3] = 0;
 	}
 
-	_vm->_system->setPalette(_screenPalette, start, count);
+	_vm->_system->getPaletteManager()->setPalette(_screenPalette, start, count);
 }
 
 uint16 Screen::updateChannel(uint16 channelIndex) {

Modified: scummvm/trunk/engines/mohawk/graphics.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/mohawk/graphics.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -147,7 +147,7 @@
 
 	delete tpalStream;
 
-	getVM()->_system->setPalette(palette, colorStart, colorCount);
+	getVM()->_system->getPaletteManager()->setPalette(palette, colorStart, colorCount);
 	delete[] palette;
 }
 
@@ -1016,7 +1016,7 @@
 
 		delete ctblStream;
 
-		_vm->_system->setPalette(palette, 0, colorCount);
+		_vm->_system->getPaletteManager()->setPalette(palette, 0, colorCount);
 		delete[] palette;
 	} else {
 		GraphicsManager::setPalette(id);

Modified: scummvm/trunk/engines/mohawk/livingbooks.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/mohawk/livingbooks.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -3018,7 +3018,7 @@
 
 			// TODO: actual fading-in
 			if (_visible && _globalVisible) {
-				_vm->_system->setPalette(_palette + _drawStart * 4, _drawStart, _drawCount);
+				_vm->_system->getPaletteManager()->setPalette(_palette + _drawStart * 4, _drawStart, _drawCount);
 				_vm->_needsRedraw = true;
 			}
 		}
@@ -3130,9 +3130,9 @@
 	}
 
 	if (on) {
-		_vm->_system->setPalette(_highlightColor, _paletteIndex + word, 1);
+		_vm->_system->getPaletteManager()->setPalette(_highlightColor, _paletteIndex + word, 1);
 	} else {
-		_vm->_system->setPalette(_foregroundColor, _paletteIndex + word, 1);
+		_vm->_system->getPaletteManager()->setPalette(_foregroundColor, _paletteIndex + word, 1);
 	}
 }
 

Modified: scummvm/trunk/engines/mohawk/view.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/view.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/mohawk/view.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -431,7 +431,7 @@
 	}
 
 	// TODO: copy into temporary buffer
-	_vm->_system->setPalette(palette, colorStart, colorCount);
+	_vm->_system->getPaletteManager()->setPalette(palette, colorStart, colorCount);
 	delete[] palette;
 
 	// original does pdLightenUp here..

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -225,7 +225,7 @@
 	byte sysPal[256*4];
 
 	uint n = pal.fillRGBA(sysPal);
-	_vm->_system->setPalette(sysPal, 0, n);
+	_vm->_system->getPaletteManager()->setPalette(sysPal, 0, n);
 }
 
 void Gfx::setBlackPalette() {

Modified: scummvm/trunk/engines/queen/display.cpp
===================================================================
--- scummvm/trunk/engines/queen/display.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/queen/display.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -167,7 +167,7 @@
 		tempPal[4 * i + 2] = *pal++;
 		tempPal[4 * i + 3] = 0;
 	}
-	_system->setPalette(tempPal, start, numColors);
+	_system->getPaletteManager()->setPalette(tempPal, start, numColors);
 	if (updateScreen) {
 		_vm->input()->delay(20);
 	}

Modified: scummvm/trunk/engines/saga/gfx.cpp
===================================================================
--- scummvm/trunk/engines/saga/gfx.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/saga/gfx.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -216,7 +216,7 @@
 	if ((_vm->getPlatform() == Common::kPlatformMacintosh) && !_vm->_scene->isInIntro())
 		memset(&_currentPal[255 * 4], 0, 4);
 
-	_system->setPalette(_currentPal, 0, PAL_ENTRIES);
+	_system->getPaletteManager()->setPalette(_currentPal, 0, PAL_ENTRIES);
 }
 
 void Gfx::setPaletteColor(int n, int r, int g, int b) {
@@ -243,7 +243,7 @@
 	}
 
 	if (update)
-		_system->setPalette(_currentPal, n, 1);
+		_system->getPaletteManager()->setPalette(_currentPal, n, 1);
 }
 
 void Gfx::getCurrentPal(PalEntry *src_pal) {
@@ -325,7 +325,7 @@
 	if ((_vm->getPlatform() == Common::kPlatformMacintosh) && !_vm->_scene->isInIntro())
 		memset(&_currentPal[255 * 4], 0, 4);
 
-	_system->setPalette(_currentPal, 0, PAL_ENTRIES);
+	_system->getPaletteManager()->setPalette(_currentPal, 0, PAL_ENTRIES);
 }
 
 void Gfx::blackToPal(PalEntry *srcPal, double percent) {
@@ -392,7 +392,7 @@
 	if ((_vm->getPlatform() == Common::kPlatformMacintosh) && !_vm->_scene->isInIntro())
 		memset(&_currentPal[255 * 4], 0, 4);
 
-	_system->setPalette(_currentPal, 0, PAL_ENTRIES);
+	_system->getPaletteManager()->setPalette(_currentPal, 0, PAL_ENTRIES);
 }
 
 #ifdef ENABLE_IHNM
@@ -455,7 +455,7 @@
 	// Color 0 should always be black in IHNM
 	memset(&fadePal[0 * 4], 0, 4);
 
-	_system->setPalette(&fadePal[start * 4], start, numColors);
+	_system->getPaletteManager()->setPalette(&fadePal[start * 4], start, numColors);
 }
 
 #endif

Modified: scummvm/trunk/engines/sci/graphics/screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/screen.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/sci/graphics/screen.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -511,7 +511,7 @@
 	// just copy palette to system
 	byte bpal[4 * 256];
 	// Get current palette, update it and put back
-	g_system->grabPalette(bpal, 0, 256);
+	g_system->getPaletteManager()->grabPalette(bpal, 0, 256);
 	for (int16 i = 1; i < 255; i++) {
 		pal->colors[i].r = bpal[i * 4];
 		pal->colors[i].g = bpal[i * 4 + 1];
@@ -523,7 +523,7 @@
 	// just copy palette to system
 	byte bpal[4 * 256];
 	// Get current palette, update it and put back
-	g_system->grabPalette(bpal, 0, 256);
+	g_system->getPaletteManager()->grabPalette(bpal, 0, 256);
 	for (int16 i = 0; i < 256; i++) {
 		if (!pal->colors[i].used)
 			continue;
@@ -532,7 +532,7 @@
 		bpal[i * 4 + 2] = CLIP(pal->colors[i].b * pal->intensity[i] / 100, 0, 255);
 		bpal[i * 4 + 3] = 100;
 	}
-	g_system->setPalette(bpal, 0, 256);
+	g_system->getPaletteManager()->setPalette(bpal, 0, 256);
 }
 
 void GfxScreen::setVerticalShakePos(uint16 shakePos) {

Modified: scummvm/trunk/engines/sci/graphics/transitions.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/transitions.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/sci/graphics/transitions.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -309,7 +309,7 @@
 	//  several pictures (e.g. qfg3 demo/intro), so the fading looked weird
 	int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 256 : 255;
 
-	g_system->grabPalette(oldPalette, 0, 256);
+	g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256);
 
 	for (stepNr = 100; stepNr >= 0; stepNr -= 10) {
 		for (colorNr = 1; colorNr < tillColorNr; colorNr++){
@@ -317,7 +317,7 @@
 			workPalette[colorNr * 4 + 1] = oldPalette[colorNr * 4 + 1] * stepNr / 100;
 			workPalette[colorNr * 4 + 2] = oldPalette[colorNr * 4 + 2] * stepNr / 100;
 		}
-		g_system->setPalette(workPalette + 4, 1, 254);
+		g_system->getPaletteManager()->setPalette(workPalette + 4, 1, 254);
 		g_sci->getEngineState()->wait(2);
 	}
 }

Modified: scummvm/trunk/engines/scumm/he/cup_player_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/cup_player_he.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/scumm/he/cup_player_he.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -127,7 +127,7 @@
 
 void CUP_Player::updateScreen() {
 	if (_paletteChanged) {
-		_system->setPalette(_paletteData, 0, 256);
+		_system->getPaletteManager()->setPalette(_paletteData, 0, 256);
 		_paletteChanged = false;
 	}
 	_system->updateScreen();

Modified: scummvm/trunk/engines/scumm/he/palette_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/palette_he.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/scumm/he/palette_he.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -394,7 +394,7 @@
 		*p++ = 0;
 	}
 
-	_system->setPalette(palette_colors, _palDirtyMin, num);
+	_system->getPaletteManager()->setPalette(palette_colors, _palDirtyMin, num);
 
 	_palDirtyMax = -1;
 	_palDirtyMin = 256;

Modified: scummvm/trunk/engines/scumm/palette.cpp
===================================================================
--- scummvm/trunk/engines/scumm/palette.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/scumm/palette.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -223,11 +223,11 @@
 				_townsClearLayerFlag = 0;
 #ifdef USE_RGB_COLOR
 			else if (_game.id == GID_LOOM)
-				towns_setTextPaletteFromPtr(tableTownsLoomPalette); 
+				towns_setTextPaletteFromPtr(tableTownsLoomPalette);
 			else if (_game.version == 3)
 				towns_setTextPaletteFromPtr(tableTownsV3Palette);
 #endif
-			
+
 			_townsScreen->toggleLayers(_townsActiveLayerFlags);
 #endif // DISABLE_TOWNS_DUAL_LAYER_MODE
 		}
@@ -1133,7 +1133,7 @@
 #endif
 #endif
 
-	_system->setPalette(palette_colors, first, num);	
+	_system->getPaletteManager()->setPalette(palette_colors, first, num);
 }
 
 } // End of namespace Scumm

Modified: scummvm/trunk/engines/scumm/smush/smush_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_player.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/scumm/smush/smush_player.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -1229,7 +1229,7 @@
 				*p++ = 0;
 			}
 
-			_vm->_system->setPalette(palette_colors, _palDirtyMin, _palDirtyMax - _palDirtyMin + 1);
+			_vm->_system->getPaletteManager()->setPalette(palette_colors, _palDirtyMin, _palDirtyMax - _palDirtyMin + 1);
 
 			_palDirtyMax = -1;
 			_palDirtyMin = 256;

Modified: scummvm/trunk/engines/sky/screen.cpp
===================================================================
--- scummvm/trunk/engines/sky/screen.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/sky/screen.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -83,7 +83,7 @@
 	}
 
 	//set the palette
-	_system->setPalette(tmpPal, 0, VGA_COLOURS);
+	_system->getPaletteManager()->setPalette(tmpPal, 0, VGA_COLOURS);
 	_currentPalette = 0;
 
 	_seqInfo.framesLeft = 0;
@@ -110,7 +110,7 @@
 //set a new palette, pal is a pointer to dos vga rgb components 0..63
 void Screen::setPalette(uint8 *pal) {
 	convertPalette(pal, _palette);
-	_system->setPalette(_palette, 0, GAME_COLOURS);
+	_system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
 	_system->updateScreen();
 }
 
@@ -123,7 +123,7 @@
 #else
 	convertPalette(pal, _palette);
 #endif
-	_system->setPalette(_palette, 0, GAME_COLOURS);
+	_system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
 	_system->updateScreen();
 }
 
@@ -135,7 +135,7 @@
 		halfPalette[(cnt << 2) | 2] = _palette[(cnt << 2) | 2] >> 1;
 		halfPalette[(cnt << 2) | 3] = 0;
 	}
-	_system->setPalette(halfPalette, 0, GAME_COLOURS);
+	_system->getPaletteManager()->setPalette(halfPalette, 0, GAME_COLOURS);
 }
 
 void Screen::setPalette(uint16 fileNum) {
@@ -249,7 +249,7 @@
 		for (uint8 cnt = 0; cnt < 32; cnt++) {
 			delayTime += 20;
 			palette_fadedown_helper((uint32 *)_palette, GAME_COLOURS);
-			_system->setPalette(_palette, 0, GAME_COLOURS);
+			_system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
 			_system->updateScreen();
 			int32 waitTime = (int32)delayTime - _system->getMillis();
 			if (waitTime < 0)
@@ -308,7 +308,7 @@
 			_palette[(colCnt << 2) | 1] = (tmpPal[(colCnt << 2) | 1] * cnt) >> 5;
 			_palette[(colCnt << 2) | 2] = (tmpPal[(colCnt << 2) | 2] * cnt) >> 5;
 		}
-		_system->setPalette(_palette, 0, GAME_COLOURS);
+		_system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
 		_system->updateScreen();
 		int32 waitTime = (int32)delayTime - _system->getMillis();
 		if (waitTime < 0)

Modified: scummvm/trunk/engines/sword1/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword1/animation.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/sword1/animation.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -176,7 +176,7 @@
 
 	byte pal[4 * 256];
 	memset(pal, 0, sizeof(pal));
-	_system->setPalette(pal, 0, 256);
+	_system->getPaletteManager()->setPalette(pal, 0, 256);
 }
 
 void MoviePlayer::performPostProcessing(byte *screen) {

Modified: scummvm/trunk/engines/sword1/control.cpp
===================================================================
--- scummvm/trunk/engines/sword1/control.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/sword1/control.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -256,7 +256,7 @@
 	}
 	palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
 	_resMan->resClose(SR_PALETTE);
-	_system->setPalette(palOut, 0, 256);
+	_system->getPaletteManager()->setPalette(palOut, 0, 256);
 	free(palOut);
 
 	char fName[10];
@@ -326,7 +326,7 @@
 	}
 	palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
 	_resMan->resClose(SR_PALETTE);
-	_system->setPalette(palOut, 0, 256);
+	_system->getPaletteManager()->setPalette(palOut, 0, 256);
 	free(palOut);
 	uint8 mode = 0, newMode = BUTTON_MAIN_PANEL;
 	bool fullRefresh = false;

Modified: scummvm/trunk/engines/sword1/screen.cpp
===================================================================
--- scummvm/trunk/engines/sword1/screen.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/sword1/screen.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -154,14 +154,14 @@
 		_fadingStep = 1;
 		_fadingDirection = FADE_UP;
 		memset(_currentPalette, 0, 256 * 4);
-		_system->setPalette(_currentPalette, 0, 256);
+		_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
 	} else
-		_system->setPalette(_targetPalette + 4 * start, start, length);
+		_system->getPaletteManager()->setPalette(_targetPalette + 4 * start, start, length);
 }
 
 void Screen::fullRefresh() {
 	_fullRefresh = true;
-	_system->setPalette(_targetPalette, 0, 256);
+	_system->getPaletteManager()->setPalette(_targetPalette, 0, 256);
 }
 
 bool Screen::stillFading() {
@@ -197,7 +197,7 @@
 	}
 	if (_fadingStep) {
 		fadePalette();
-		_system->setPalette(_currentPalette, 0, 256);
+		_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
 	}
 
 	uint16 scrlX = (uint16)Logic::_scriptVars[SCROLL_OFFSET_X];

Modified: scummvm/trunk/engines/sword2/palette.cpp
===================================================================
--- scummvm/trunk/engines/sword2/palette.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/sword2/palette.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -293,7 +293,7 @@
 	} else
 		palette = colors;
 
-	_vm->_system->setPalette(palette, start, num);
+	_vm->_system->getPaletteManager()->setPalette(palette, start, num);
 }
 
 } // End of namespace Sword2

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -1185,7 +1185,7 @@
 			p[i * 4 + c] = (unsigned)palette[i * 3 + c] * mul;
 	}
 
-	_system->setPalette(p, 0, 256);
+	_system->getPaletteManager()->setPalette(p, 0, 256);
 }
 
 Object *Scene::getObject(int id, int scene_id) {

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -301,7 +301,7 @@
 		palette[idx + 1] *= 4;
 		palette[idx + 2] *= 4;
 	}
-	_system->setPalette(palette, 0, 0x100);
+	_system->getPaletteManager()->setPalette(palette, 0, 0x100);
 	_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
 	_system->updateScreen();
 
@@ -338,7 +338,7 @@
 		palette[idx + 1] *= 4;
 		palette[idx + 2] *= 4;
 	}
-	_system->setPalette(palette, 0, 0x100);
+	_system->getPaletteManager()->setPalette(palette, 0, 0x100);
 
 	uint n = logo.fileCount();
 	for(uint f = 0; f < 4; ++f)
@@ -386,7 +386,7 @@
 		}
 	}
 
-	_system->setPalette(palette, 0, 0x100);
+	_system->getPaletteManager()->setPalette(palette, 0, 0x100);
 
 	byte varia_6[21760], varia_9[18302];
 	varia.read(6, varia_6, sizeof(varia_6));

Modified: scummvm/trunk/engines/testbed/graphics.cpp
===================================================================
--- scummvm/trunk/engines/testbed/graphics.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/testbed/graphics.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -44,7 +44,7 @@
 	// Initialize color palettes
 	// The fourth field is for alpha channel which is unused
 	// Assuming 8bpp as of now
-	g_system->setPalette(_palette, 0, 3);
+	g_system->getPaletteManager()->setPalette(_palette, 0, 3);
 
 	// Init Mouse Palette (White-black-yellow)
 	GFXtests::initMousePalette();
@@ -88,7 +88,7 @@
 	_palette[absIndx + 1] = 173;
 	_palette[absIndx + 2] = 255;
 	_palette[absIndx + 3] = 47;
-	g_system->setPalette(_palette, 0, 256);
+	g_system->getPaletteManager()->setPalette(_palette, 0, 256);
 }
 
 // Helper functions used by GFX tests
@@ -982,7 +982,7 @@
 	}
 
 	// Initialize this palette.
-	g_system->setPalette(palette, 0, 256);
+	g_system->getPaletteManager()->setPalette(palette, 0, 256);
 
 	// Draw 256 Rectangles, each 1 pixel wide and 10 pixels long
 	// one for 0-255 color range other for 0-127-255 range
@@ -1020,7 +1020,7 @@
 		rotatePalette(palette, 256);
 
 		g_system->delayMillis(10);
-		g_system->setPalette(palette, 0, 256);
+		g_system->getPaletteManager()->setPalette(palette, 0, 256);
 		g_system->updateScreen();
 	}
 

Modified: scummvm/trunk/engines/tinsel/palette.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/palette.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/tinsel/palette.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -165,7 +165,7 @@
 		}
 
 		// update the system palette
-		g_system->setPalette((const byte *)pColours, pDACtail->destDACindex, pDACtail->numColours);
+		g_system->getPaletteManager()->setPalette((const byte *)pColours, pDACtail->destDACindex, pDACtail->numColours);
 
 		// update tail pointer
 		pDACtail++;

Modified: scummvm/trunk/engines/toon/toon.cpp
===================================================================
--- scummvm/trunk/engines/toon/toon.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/toon/toon.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -930,7 +930,7 @@
 		vmpalette[i*4+2] = _finalPalette[i*3+2];
 		vmpalette[i*4+3] = 0;
 	}
-	_system->setPalette(vmpalette, 0, 256);
+	_system->getPaletteManager()->setPalette(vmpalette, 0, 256);
 }
 void ToonEngine::setPaletteEntries(uint8 *palette, int32 offset, int32 num) {
 	memcpy(_finalPalette + offset * 3, palette, num * 3);
@@ -1758,7 +1758,7 @@
 			vmpalette[i*4+2] = f * _finalPalette[i*3+2] / (numFrames - 1);
 			vmpalette[i*4+3] = 0;
 		}
-		_system->setPalette(vmpalette, 0, 256);
+		_system->getPaletteManager()->setPalette(vmpalette, 0, 256);
 		_system->updateScreen();
 		_system->delayMillis(_tickLength);
 	}
@@ -1767,7 +1767,7 @@
 void ToonEngine::fadeOut(int32 numFrames) {
 
 	uint8 oldpalette[1024];
-	_system->grabPalette(oldpalette, 0, 256);
+	_system->getPaletteManager()->grabPalette(oldpalette, 0, 256);
 
 	for (int32 f = 0; f < numFrames; f++) {
 		uint8 vmpalette[1024];
@@ -1777,7 +1777,7 @@
 			vmpalette[i*4+2] = (numFrames - f - 1) * oldpalette[i*4+2] / (numFrames - 1);
 			vmpalette[i*4+3] = 255;
 		}
-		_system->setPalette(vmpalette, 0, 256);
+		_system->getPaletteManager()->setPalette(vmpalette, 0, 256);
 		_system->updateScreen();
 		_system->delayMillis(_tickLength);
 	}

Modified: scummvm/trunk/engines/touche/touche.cpp
===================================================================
--- scummvm/trunk/engines/touche/touche.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/touche/touche.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -3259,7 +3259,7 @@
 
 		pal[i * 4 + 3] = 0;
 	}
-	_system->setPalette(&pal[firstColor * 4], firstColor, colorCount);
+	_system->getPaletteManager()->setPalette(&pal[firstColor * 4], firstColor, colorCount);
 }
 
 void ToucheEngine::updateScreenArea(int x, int y, int w, int h) {
@@ -3294,7 +3294,7 @@
 }
 
 void ToucheEngine::updatePalette() {
-	_system->setPalette(_paletteBuffer, 0, 256);
+	_system->getPaletteManager()->setPalette(_paletteBuffer, 0, 256);
 }
 
 bool ToucheEngine::canLoadGameStateCurrently() {

Modified: scummvm/trunk/engines/tucker/locations.cpp
===================================================================
--- scummvm/trunk/engines/tucker/locations.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/tucker/locations.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -1798,7 +1798,7 @@
 			scrollPal[i * 4 + 1] = g[i + d];
 			scrollPal[i * 4 + 2] = b[i + d];
 		}
-		_system->setPalette(scrollPal, 118, 5);
+		_system->getPaletteManager()->setPalette(scrollPal, 118, 5);
 		if (_flagsTable[143] == 1) {
 			_locationObjectsTable[2].xPos = 999;
 			_locationObjectsTable[3].xPos = 187;

Modified: scummvm/trunk/engines/tucker/sequences.cpp
===================================================================
--- scummvm/trunk/engines/tucker/sequences.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/tucker/sequences.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -550,7 +550,7 @@
 			updateSounds();
 		}
 		_system->copyRectToScreen(_offscreenBuffer, kScreenWidth, 0, 0, kScreenWidth, kScreenHeight);
-		_system->setPalette(_animationPalette, 0, 256);
+		_system->getPaletteManager()->setPalette(_animationPalette, 0, 256);
 		_system->updateScreen();
 		syncTime();
 	} while (_seqNum != 1);
@@ -691,7 +691,7 @@
 					fadeColors = true;
 				}
 			}
-			_system->setPalette(paletteBuffer, 0, 256);
+			_system->getPaletteManager()->setPalette(paletteBuffer, 0, 256);
 			_system->updateScreen();
 		}
 		_system->delayMillis(1000 / 60);
@@ -712,7 +712,7 @@
 					fadeColors = true;
 				}
 			}
-			_system->setPalette(paletteBuffer, 0, 256);
+			_system->getPaletteManager()->setPalette(paletteBuffer, 0, 256);
 			_system->updateScreen();
 		}
 		_system->delayMillis(1000 / 60);

Modified: scummvm/trunk/engines/tucker/tucker.cpp
===================================================================
--- scummvm/trunk/engines/tucker/tucker.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/engines/tucker/tucker.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -943,46 +943,46 @@
 
 void TuckerEngine::fadeOutPalette(int colorsCount) {
 	uint8 pal[256 * 4];
-	_system->grabPalette(pal, 0, colorsCount);
+	_system->getPaletteManager()->grabPalette(pal, 0, colorsCount);
 	for (int color = 0; color < colorsCount; ++color) {
 		for (int i = 0; i < 3; ++i) {
 			const int c = int(pal[color * 4 + i]) + kFadePaletteStep * 4;
 			pal[color * 4 + i] = MIN<int>(c, _currentPalette[color * 3 + i]);
 		}
 	}
-	_system->setPalette(pal, 0, colorsCount);
+	_system->getPaletteManager()->setPalette(pal, 0, colorsCount);
 	_system->updateScreen();
 	waitForTimer(1);
 }
 
 void TuckerEngine::fadeInPalette(int colorsCount) {
 	uint8 pal[256 * 4];
-	_system->grabPalette(pal, 0, colorsCount);
+	_system->getPaletteManager()->grabPalette(pal, 0, colorsCount);
 	for (int color = 0; color < colorsCount; ++color) {
 		for (int i = 0; i < 3; ++i) {
 			const int c = int(pal[color * 4 + i]) - kFadePaletteStep * 4;
 			pal[color * 4 + i] = MAX<int>(c, 0);
 		}
 	}
-	_system->setPalette(pal, 0, colorsCount);
+	_system->getPaletteManager()->setPalette(pal, 0, colorsCount);
 	_system->updateScreen();
 	waitForTimer(1);
 }
 
 void TuckerEngine::fadePaletteColor(int color, int step) {
 	uint8 rgb[4];
-	_system->grabPalette(rgb, color, 1);
+	_system->getPaletteManager()->grabPalette(rgb, color, 1);
 	for (int i = 0; i < 3; ++i) {
 		const int c = _currentPalette[color * 3 + i] + step * 4;
 		rgb[i] = MIN(c, 255);
 	}
-	_system->setPalette(rgb, color, 1);
+	_system->getPaletteManager()->setPalette(rgb, color, 1);
 }
 
 void TuckerEngine::setBlackPalette() {
 	uint8 pal[256 * 4];
 	memset(pal, 0, sizeof(pal));
-	_system->setPalette(pal, 0, 256);
+	_system->getPaletteManager()->setPalette(pal, 0, 256);
 }
 
 void TuckerEngine::updateCursor() {

Added: scummvm/trunk/graphics/palette.h
===================================================================
--- scummvm/trunk/graphics/palette.h	                        (rev 0)
+++ scummvm/trunk/graphics/palette.h	2011-02-07 17:52:38 UTC (rev 55806)
@@ -0,0 +1,107 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef GRAPHICS_PALETTE_H
+#define GRAPHICS_PALETTE_H
+
+#include "common/noncopyable.h"
+
+/**
+ * The PaletteManager is part of the OSystem backend API and responsible
+ * for handling the (possibly emulated) "hardware" palette needed for
+ * many old games (e.g. in EGA and VGA mode).
+ *
+ * By itself it is a pure abstract class, i.e. an "interface"; you can
+ * use the OSystem::getPaletteManager() method to obtain an instance
+ * that you can use to perform actual palette modifications.
+ */
+class PaletteManager : Common::NonCopyable {
+public:
+	virtual ~PaletteManager() {}
+
+	/**
+	 * Replace the specified range of the palette with new colors.
+	 * The palette entries from 'start' till (start+num-1) will be replaced - so
+	 * a full palette update is accomplished via start=0, num=256.
+	 *
+	 * The palette data is specified in interleaved RGBA format. That is, the
+	 * first byte of the memory block 'colors' points at is the red component
+	 * of the first new color; the second byte the green component of the first
+	 * new color; the third byte the blue component, the last byte to the alpha
+	 * (transparency) value. Then the second color starts, and so on. So memory
+	 * looks like this: R1-G1-B1-A1-R2-G2-B2-A2-R3-...
+	 *
+	 * @param colors	the new palette data, in interleaved RGBA format
+	 * @param start		the first palette entry to be updated
+	 * @param num		the number of palette entries to be updated
+	 *
+	 * @note It is an error if start+num exceeds 256, behaviour is undefined
+	 *       in that case (the backend may ignore it silently or assert).
+	 * @note It is an error if this function gets called when the pixel format
+	 *       in use (the return value of getScreenFormat) has more than one
+	 *       byte per pixel.
+	 * @note The alpha value is not actually used, and future revisions of this
+	 *       API are probably going to remove it.
+	 *
+	 * @see getScreenFormat
+	 */
+	virtual void setPalette(const byte *colors, uint start, uint num) = 0;
+
+	/**
+	 * Grabs a specified part of the currently active palette.
+	 * The format is the same as for setPalette.
+	 *
+	 * This should return exactly the same RGB data as was setup via previous
+	 * setPalette calls.
+	 *
+	 * For example, for every valid value of start and num of the following
+	 * code:
+	 *
+	 * byte origPal[num*4];
+	 * // Setup origPal's data however you like
+	 * g_system->setPalette(origPal, start, num);
+	 * byte obtainedPal[num*4];
+	 * g_system->grabPalette(obtainedPal, start, num);
+	 *
+	 * the following should be true:
+	 *
+	 * For each i < num : memcmp(&origPal[i*4], &obtainedPal[i*4], 3) == 0
+	 * (i is an uint here)
+	 *
+	 * @see setPalette
+	 * @param colors	the palette data, in interleaved RGBA format
+	 * @param start		the first platte entry to be read
+	 * @param num		the number of palette entries to be read
+	 *
+	 * @note It is an error if this function gets called when the pixel format
+	 *       in use (the return value of getScreenFormat) has more than one
+	 *       byte per pixel.
+	 *
+	 * @see getScreenFormat
+	 */
+	virtual void grabPalette(byte *colors, uint start, uint num) = 0;
+};
+
+#endif


Property changes on: scummvm/trunk/graphics/palette.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/graphics/scaler/thumbnail_intern.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/thumbnail_intern.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/graphics/scaler/thumbnail_intern.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -110,7 +110,7 @@
 	if (screenFormat.bytesPerPixel == 1) {
 		palette = new byte[256 * 4];
 		assert(palette);
-		g_system->grabPalette(palette, 0, 256);
+		g_system->getPaletteManager()->grabPalette(palette, 0, 256);
 	}
 
 	for (uint y = 0; y < screen->h; ++y) {

Modified: scummvm/trunk/sound/softsynth/mt32.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/mt32.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/sound/softsynth/mt32.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -320,7 +320,7 @@
 			171, 0, 0, 0	// fill
 		};
 
-		g_system->setPalette(dummy_palette, 0, 3);
+		g_system->getPaletteManager()->setPalette(dummy_palette, 0, 3);
 	}
 
 	_initialising = true;

Modified: scummvm/trunk/video/video_decoder.cpp
===================================================================
--- scummvm/trunk/video/video_decoder.cpp	2011-02-07 17:47:20 UTC (rev 55805)
+++ scummvm/trunk/video/video_decoder.cpp	2011-02-07 17:52:38 UTC (rev 55806)
@@ -60,7 +60,7 @@
 		sysPalette[i * 4 + 3] = 0;
 	}
 
-	g_system->setPalette(sysPalette, 0, 256);
+	g_system->getPaletteManager()->setPalette(sysPalette, 0, 256);
 	delete[] sysPalette;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list