OPENGL: Fix palette issues.

svn-id: r51012
This commit is contained in:
Alejandro Marzini 2010-07-19 02:32:36 +00:00
parent 03d66c4012
commit 7ad017bde0

View file

@ -49,8 +49,8 @@ OpenGLGraphicsManager::OpenGLGraphicsManager()
_videoMode.scaleFactor = 1; _videoMode.scaleFactor = 1;
_videoMode.fullscreen = false; _videoMode.fullscreen = false;
_gamePalette = (byte *)calloc(sizeof(byte), 256); _gamePalette = (byte *)calloc(sizeof(byte) * 4, 256);
_cursorPalette = (byte *)calloc(sizeof(byte), 256); _cursorPalette = (byte *)calloc(sizeof(byte) * 4, 256);
// Register the graphics manager as a event observer // Register the graphics manager as a event observer
g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 2, false); g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 2, false);
@ -285,7 +285,7 @@ void OpenGLGraphicsManager::setPalette(const byte *colors, uint start, uint num)
#endif #endif
// Save the screen palette // Save the screen palette
memcpy(_cursorPalette + start * 4, colors, num * 4); memcpy(_gamePalette + start * 4, colors, num * 4);
if (_cursorPaletteDisabled) if (_cursorPaletteDisabled)
_cursorNeedsRedraw = true; _cursorNeedsRedraw = true;
@ -299,7 +299,7 @@ void OpenGLGraphicsManager::grabPalette(byte *colors, uint start, uint num) {
#endif #endif
// Copies current palette to buffer // Copies current palette to buffer
memcpy(colors, _cursorPalette + start * 4, num * 4); memcpy(colors, _gamePalette + start * 4, num * 4);
} }
void OpenGLGraphicsManager::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { void OpenGLGraphicsManager::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {