Fixed the palette problems in 24/32 bit OpenGL video modes.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@235 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2004-04-15 22:52:43 +00:00
parent 0591a92fa7
commit d64aacef70
4 changed files with 37 additions and 8 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferGL.hxx,v 1.8 2004-04-12 23:28:42 stephena Exp $ // $Id: FrameBufferGL.hxx,v 1.9 2004-04-15 22:52:43 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_GL_HXX #ifndef FRAMEBUFFER_GL_HXX
@ -34,7 +34,7 @@ class MediaSource;
This class implements an SDL OpenGL framebuffer. This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.8 2004-04-12 23:28:42 stephena Exp $ @version $Id: FrameBufferGL.hxx,v 1.9 2004-04-15 22:52:43 stephena Exp $
*/ */
class FrameBufferGL : public FrameBufferSDL class FrameBufferGL : public FrameBufferSDL
{ {
@ -64,6 +64,16 @@ class FrameBufferGL : public FrameBufferSDL
*/ */
virtual bool createScreen(); virtual bool createScreen();
/**
This routine is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@param b The blue component of the color.
*/
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b)
{ return SDL_MapRGB(myTexture->format, r, g, b); }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx // The following methods are derived from FrameBuffer.hxx
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferSDL.cxx,v 1.10 2003-12-10 18:58:56 stephena Exp $ // $Id: FrameBufferSDL.cxx,v 1.11 2004-04-15 22:52:43 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h> #include <SDL.h>
@ -70,7 +70,7 @@ void FrameBufferSDL::setupPalette()
g = (Uint8) (((gamePalette[i] & 0x0000ff00) >> 8) * shade); g = (Uint8) (((gamePalette[i] & 0x0000ff00) >> 8) * shade);
b = (Uint8) ((gamePalette[i] & 0x000000ff) * shade); b = (Uint8) ((gamePalette[i] & 0x000000ff) * shade);
myPalette[i] = SDL_MapRGB(myScreen->format, r, g, b); myPalette[i] = mapRGB(r, g, b);
} }
theRedrawEntireFrameIndicator = true; theRedrawEntireFrameIndicator = true;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferSDL.hxx,v 1.9 2003-12-10 18:58:56 stephena Exp $ // $Id: FrameBufferSDL.hxx,v 1.10 2004-04-15 22:52:43 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_SDL_HXX #ifndef FRAMEBUFFER_SDL_HXX
@ -34,7 +34,7 @@
the core FrameBuffer. the core FrameBuffer.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferSDL.hxx,v 1.9 2003-12-10 18:58:56 stephena Exp $ @version $Id: FrameBufferSDL.hxx,v 1.10 2004-04-15 22:52:43 stephena Exp $
*/ */
class FrameBufferSDL : public FrameBuffer class FrameBufferSDL : public FrameBuffer
{ {
@ -121,6 +121,15 @@ class FrameBufferSDL : public FrameBuffer
*/ */
virtual bool createScreen() = 0; virtual bool createScreen() = 0;
/**
This routine is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@param b The blue component of the color.
*/
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) = 0;
protected: protected:
// The SDL video buffer // The SDL video buffer
SDL_Surface* myScreen; SDL_Surface* myScreen;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferSoft.hxx,v 1.2 2003-12-10 18:58:56 stephena Exp $ // $Id: FrameBufferSoft.hxx,v 1.3 2004-04-15 22:52:43 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX #ifndef FRAMEBUFFER_SOFT_HXX
@ -35,7 +35,7 @@ class RectList;
This class implements an SDL software framebuffer. This class implements an SDL software framebuffer.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.2 2003-12-10 18:58:56 stephena Exp $ @version $Id: FrameBufferSoft.hxx,v 1.3 2004-04-15 22:52:43 stephena Exp $
*/ */
class FrameBufferSoft : public FrameBufferSDL class FrameBufferSoft : public FrameBufferSDL
{ {
@ -59,6 +59,16 @@ class FrameBufferSoft : public FrameBufferSDL
*/ */
virtual bool createScreen(); virtual bool createScreen();
/**
This routine is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@param b The blue component of the color.
*/
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b)
{ return SDL_MapRGB(myScreen->format, r, g, b); }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx // The following methods are derived from FrameBuffer.hxx
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////