mirror of https://github.com/stella-emu/stella.git
Made changes in EventHandler state not re-create the FrameBuffer object.
The only time the FrameBuffer is (re)created is when one doesn't exist (at the start of program), or when toggling between software and OpenGL mode. Hopefully this will fix the problems in the GP2X port wrt the new SDL libs. But even if it doesn't, I think it's a cleaner way of doing things ... git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1166 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
4c8743b04e
commit
78f33efe78
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferSoft.cxx,v 1.58 2006-11-28 21:48:55 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.59 2006-12-02 00:43:49 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -44,7 +44,6 @@ FrameBufferSoft::~FrameBufferSoft()
|
|||
{
|
||||
delete myRectList;
|
||||
delete myOverlayRectList;
|
||||
cls();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EventHandler.cxx,v 1.176 2006-12-01 18:30:18 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.177 2006-12-02 00:43:50 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -2243,7 +2243,6 @@ bool EventHandler::enterDebugMode()
|
|||
|
||||
setEventState(S_DEBUGGER);
|
||||
myOSystem->createFrameBuffer();
|
||||
myOSystem->console().setPalette(myOSystem->settings().getString("palette"));
|
||||
myOverlay->reStack();
|
||||
myOSystem->frameBuffer().setCursorState();
|
||||
myEvent->clear();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBuffer.cxx,v 1.100 2006-11-29 20:01:56 azaballa Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.101 2006-12-02 00:43:50 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -46,8 +46,6 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
|
|||
myPhosphorBlend(77),
|
||||
myFrameRate(0)
|
||||
{
|
||||
myBaseDim.x = myBaseDim.y = myBaseDim.w = myBaseDim.h = 0;
|
||||
myImageDim = myScreenDim = myDesktopDim = myBaseDim;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -75,6 +73,9 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
|
|||
}
|
||||
setWindowIcon();
|
||||
|
||||
// Erase old contents
|
||||
cls();
|
||||
|
||||
// Query the desktop size
|
||||
// This is really the job of SDL
|
||||
int dwidth = 0, dheight = 0;
|
||||
|
@ -102,9 +103,6 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
|
|||
setScaler(scaler);
|
||||
initSubsystem();
|
||||
|
||||
// Erase old contents
|
||||
cls();
|
||||
|
||||
// And refresh the display
|
||||
myOSystem->eventHandler().refreshDisplay();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OSystem.cxx,v 1.75 2006-11-06 00:52:03 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.76 2006-12-02 00:43:50 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -220,11 +220,22 @@ void OSystem::setFramerate(uInt32 framerate)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool OSystem::createFrameBuffer(bool showmessage)
|
||||
{
|
||||
// Delete the old framebuffer
|
||||
delete myFrameBuffer; myFrameBuffer = NULL;
|
||||
|
||||
// And recreate a new one (we'll always get a valid pointer)
|
||||
myFrameBuffer = MediaFactory::createVideo(this);
|
||||
// Check if we can re-use the current framebuffer
|
||||
bool changeBuffer = (myFrameBuffer == NULL);
|
||||
if(!changeBuffer)
|
||||
{
|
||||
if((mySettings->getString("video") == "soft" &&
|
||||
myFrameBuffer->type() != kSoftBuffer) ||
|
||||
(mySettings->getString("video") == "gl" &&
|
||||
myFrameBuffer->type() != kGLBuffer))
|
||||
changeBuffer = true;
|
||||
}
|
||||
// Now we only create when absolutely necessary
|
||||
if(changeBuffer)
|
||||
{
|
||||
delete myFrameBuffer;
|
||||
myFrameBuffer = MediaFactory::createVideo(this);
|
||||
}
|
||||
|
||||
// Re-initialize the framebuffer to current settings
|
||||
switch(myEventHandler->state())
|
||||
|
@ -262,7 +273,7 @@ bool OSystem::createFrameBuffer(bool showmessage)
|
|||
}
|
||||
|
||||
// Setup the SDL joysticks (must be done after FrameBuffer is created)
|
||||
myEventHandler->setupJoysticks();
|
||||
if(changeBuffer) myEventHandler->setupJoysticks();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -291,6 +302,17 @@ void OSystem::toggleFrameBuffer()
|
|||
|
||||
// And re-pause the system
|
||||
myEventHandler->pause(pause);
|
||||
|
||||
// The palette and phosphor info for the framebuffer will be lost
|
||||
// when a new framebuffer is created; we must restore it
|
||||
if(myConsole)
|
||||
{
|
||||
const Properties& props = myConsole->properties();
|
||||
bool enable = props.get(Display_Phosphor) == "YES";
|
||||
int blend = atoi(props.get(Display_PPBlend).c_str());
|
||||
myFrameBuffer->enablePhosphor(enable, blend);
|
||||
myConsole->setPalette(mySettings->getString("palette"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue