OK, another large FrameBuffer-related change so that fullscreen,

double-buffered modes don't have flicker.  Basically, the core FrameBuffer
class has been modified to draw dialogs multiple times when necessary,
above and beyond when changes are made (ie, if a new surface is to be
overlaid, all surfaces underneath must be drawn to BOTH buffers in
double-buffered mode first).

Software rendering is currently broken in fullscreen mode, but I know
why.  It's basically the optimizations I try to make for large software
surfaces (the 'isBase' functionality).  This is going to disappear before
the next release.  And in case I haven't mentioned it for a while; I
REALLY HATE software mode.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1577 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-12-27 23:27:32 +00:00
parent 4051b523d8
commit 5b4f9f3781
14 changed files with 133 additions and 114 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.cxx,v 1.125 2008-12-27 15:56:35 stephena Exp $ // $Id: FrameBufferGL.cxx,v 1.126 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
@ -401,7 +401,7 @@ cerr << "dimensions: " << (fullScreen() ? "(full)" : "") << endl
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::drawMediaSource() void FrameBufferGL::drawMediaSource(bool fullRedraw)
{ {
MediaSource& mediasrc = myOSystem->console().mediaSource(); MediaSource& mediasrc = myOSystem->console().mediaSource();
@ -427,7 +427,7 @@ void FrameBufferGL::drawMediaSource()
uInt8 v = currentFrame[bufofs]; uInt8 v = currentFrame[bufofs];
uInt8 w = previousFrame[bufofs]; uInt8 w = previousFrame[bufofs];
if(v != w || myRedrawEntireFrame) if(v != w || fullRedraw)
{ {
// If we ever get to this point, we know the current and previous // If we ever get to this point, we know the current and previous
// buffers differ. In that case, make sure the changes are // buffers differ. In that case, make sure the changes are
@ -445,7 +445,7 @@ void FrameBufferGL::drawMediaSource()
else else
{ {
// Phosphor mode always implies a dirty update, // Phosphor mode always implies a dirty update,
// so we don't care about myRedrawEntireFrame // so we don't care about fullRedraw
myDirtyFlag = true; myDirtyFlag = true;
uInt32 bufofsY = 0; uInt32 bufofsY = 0;
@ -792,6 +792,8 @@ void FBSurfaceGL::update()
{ {
if(mySurfaceIsDirty) if(mySurfaceIsDirty)
{ {
//cerr << " --> FBSurfaceGL::update(): w = " << myWidth << ", h = " << myHeight << endl;
// Texturemap complete texture to surface so we have free scaling // Texturemap complete texture to surface so we have free scaling
// and antialiasing // and antialiasing
p_glBindTexture(myTexTarget, myTexID); p_glBindTexture(myTexTarget, myTexID);

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.64 2008-12-21 19:51:35 stephena Exp $ // $Id: FrameBufferGL.hxx,v 1.65 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_GL_HXX #ifndef FRAMEBUFFER_GL_HXX
@ -35,7 +35,7 @@ class FBSurfaceGL;
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.64 2008-12-21 19:51:35 stephena Exp $ @version $Id: FrameBufferGL.hxx,v 1.65 2008-12-27 23:27:32 stephena Exp $
*/ */
class FrameBufferGL : public FrameBuffer class FrameBufferGL : public FrameBuffer
{ {
@ -134,9 +134,9 @@ class FrameBufferGL : public FrameBuffer
/** /**
This method should be called anytime the MediaSource needs to be redrawn This method should be called anytime the MediaSource needs to be redrawn
to the screen. to the screen (full indicating that a full redraw is required).
*/ */
void drawMediaSource(); void drawMediaSource(bool full);
/** /**
This method is called to provide information about the FrameBuffer. This method is called to provide information about the FrameBuffer.
@ -185,7 +185,7 @@ class FrameBufferGL : public FrameBuffer
A surface suitable for OpenGL rendering mode. A surface suitable for OpenGL rendering mode.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.64 2008-12-21 19:51:35 stephena Exp $ @version $Id: FrameBufferGL.hxx,v 1.65 2008-12-27 23:27:32 stephena Exp $
*/ */
class FBSurfaceGL : public FBSurface class FBSurfaceGL : public FBSurface
{ {

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.cxx,v 1.84 2008-12-26 20:05:16 stephena Exp $ // $Id: FrameBufferSoft.cxx,v 1.85 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -123,7 +123,7 @@ bool FrameBufferSoft::setVidMode(VideoMode& mode)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::drawMediaSource() void FrameBufferSoft::drawMediaSource(bool fullRedraw)
{ {
MediaSource& mediasrc = myOSystem->console().mediaSource(); MediaSource& mediasrc = myOSystem->console().mediaSource();
@ -155,7 +155,7 @@ void FrameBufferSoft::drawMediaSource()
uInt8 v = currentFrame[bufofs]; uInt8 v = currentFrame[bufofs];
uInt8 w = previousFrame[bufofs]; uInt8 w = previousFrame[bufofs];
if(v != w || myRedrawEntireFrame) if(v != w || fullRedraw)
{ {
while(xstride--) while(xstride--)
{ {
@ -195,7 +195,7 @@ void FrameBufferSoft::drawMediaSource()
uInt8 v = currentFrame[bufofs]; uInt8 v = currentFrame[bufofs];
uInt8 w = previousFrame[bufofs]; uInt8 w = previousFrame[bufofs];
if(v != w || myRedrawEntireFrame) if(v != w || fullRedraw)
{ {
uInt32 pixel = myDefPalette[v]; uInt32 pixel = myDefPalette[v];
uInt8 r = (pixel & myFormat->Rmask) >> myFormat->Rshift; uInt8 r = (pixel & myFormat->Rmask) >> myFormat->Rshift;
@ -240,7 +240,7 @@ void FrameBufferSoft::drawMediaSource()
uInt8 v = currentFrame[bufofs]; uInt8 v = currentFrame[bufofs];
uInt8 w = previousFrame[bufofs]; uInt8 w = previousFrame[bufofs];
if(v != w || myRedrawEntireFrame) if(v != w || fullRedraw)
{ {
while(xstride--) while(xstride--)
{ {
@ -422,7 +422,7 @@ void FrameBufferSoft::stateChanged(EventHandler::State state)
} }
// Have the changes take effect // Have the changes take effect
myOSystem->eventHandler().refreshDisplay(); refresh();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.57 2008-12-20 23:32:46 stephena Exp $ // $Id: FrameBufferSoft.hxx,v 1.58 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX #ifndef FRAMEBUFFER_SOFT_HXX
@ -32,7 +32,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.57 2008-12-20 23:32:46 stephena Exp $ @version $Id: FrameBufferSoft.hxx,v 1.58 2008-12-27 23:27:32 stephena Exp $
*/ */
class FrameBufferSoft : public FrameBuffer class FrameBufferSoft : public FrameBuffer
{ {
@ -122,9 +122,9 @@ class FrameBufferSoft : public FrameBuffer
/** /**
This method should be called anytime the MediaSource needs to be redrawn This method should be called anytime the MediaSource needs to be redrawn
to the screen. to the screen (full indicating that a full redraw is required).
*/ */
void drawMediaSource(); void drawMediaSource(bool full);
/** /**
This method is called after any drawing is done (per-frame). This method is called after any drawing is done (per-frame).
@ -172,7 +172,7 @@ class FrameBufferSoft : public FrameBuffer
A surface suitable for software rendering mode. A surface suitable for software rendering mode.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.57 2008-12-20 23:32:46 stephena Exp $ @version $Id: FrameBufferSoft.hxx,v 1.58 2008-12-27 23:27:32 stephena Exp $
*/ */
class FBSurfaceSoft : public FBSurface class FBSurfaceSoft : public FBSurface
{ {

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: TiaOutputWidget.cxx,v 1.20 2008-12-23 18:54:05 stephena Exp $ // $Id: TiaOutputWidget.cxx,v 1.21 2008-12-27 23:27:32 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -139,8 +139,9 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::drawWidget(bool hilite) void TiaOutputWidget::drawWidget(bool hilite)
{ {
return; /*
// FIXME - check if we're in 'greyed out mode' and act accordingly // FIXME - check if we're in 'greyed out mode' and act accordingly
instance().frameBuffer().refresh(); instance().frameBuffer().refresh();
instance().frameBuffer().drawMediaSource(); instance().frameBuffer().drawMediaSource();
*/
} }

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: EventHandler.cxx,v 1.228 2008-07-22 14:54:38 stephena Exp $ // $Id: EventHandler.cxx,v 1.229 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -157,36 +157,6 @@ void EventHandler::reset(State state)
myOSystem->state().reset(); myOSystem->state().reset();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::refreshDisplay(bool forceUpdate)
{
switch(myState)
{
case S_EMULATE:
case S_PAUSE:
if(&myOSystem->frameBuffer())
myOSystem->frameBuffer().refresh();
break;
case S_MENU: // fall through to next case
case S_CMDMENU:
if(&myOSystem->frameBuffer())
myOSystem->frameBuffer().refresh();
case S_LAUNCHER:
case S_DEBUGGER:
if(myOverlay)
myOverlay->refresh();
break;
default:
return;
break;
}
if(forceUpdate && &myOSystem->frameBuffer())
myOSystem->frameBuffer().update();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setupJoysticks() void EventHandler::setupJoysticks()
{ {
@ -622,7 +592,7 @@ void EventHandler::poll(uInt32 time)
break; // SDL_QUIT break; // SDL_QUIT
case SDL_VIDEOEXPOSE: case SDL_VIDEOEXPOSE:
refreshDisplay(); myOSystem->frameBuffer().refresh();
break; // SDL_VIDEOEXPOSE break; // SDL_VIDEOEXPOSE
#ifdef JOYSTICK_SUPPORT #ifdef JOYSTICK_SUPPORT
@ -1968,8 +1938,6 @@ void EventHandler::setEventState(State state)
myOSystem->stateChanged(myState); myOSystem->stateChanged(myState);
if(&myOSystem->frameBuffer()) if(&myOSystem->frameBuffer())
myOSystem->frameBuffer().stateChanged(myState); myOSystem->frameBuffer().stateChanged(myState);
refreshDisplay();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: EventHandler.hxx,v 1.111 2008-05-30 19:07:55 stephena Exp $ // $Id: EventHandler.hxx,v 1.112 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -61,7 +61,7 @@ enum EventMode {
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.111 2008-05-30 19:07:55 stephena Exp $ @version $Id: EventHandler.hxx,v 1.112 2008-12-27 23:27:32 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
@ -171,14 +171,6 @@ class EventHandler
*/ */
void reset(State state); void reset(State state);
/**
Refresh display according to the current state
@param forceUpdate Do a framebuffer update right away, instead
of waiting for the next frame
*/
void refreshDisplay(bool forceUpdate = false);
/** /**
This method indicates that the system should terminate. This method indicates that the system should terminate.
*/ */

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: FrameBuffer.cxx,v 1.147 2008-12-27 15:56:35 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.148 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -119,9 +119,6 @@ cerr << " <== FrameBuffer::initialize: w = " << width << ", h = " << height << e
else else
return false; return false;
// And refresh the display
myOSystem->eventHandler().refreshDisplay();
// Enable unicode so we can see translated key events // Enable unicode so we can see translated key events
// (lowercase vs. uppercase characters) // (lowercase vs. uppercase characters)
SDL_EnableUNICODE(1); SDL_EnableUNICODE(1);
@ -169,7 +166,7 @@ void FrameBuffer::update()
myOSystem->console().fry(); myOSystem->console().fry();
// And update the screen // And update the screen
drawMediaSource(); drawMediaSource(myRedrawEntireFrame);
// Show frame statistics // Show frame statistics
if(myStatsMsg.enabled) if(myStatsMsg.enabled)
@ -193,7 +190,7 @@ void FrameBuffer::update()
{ {
// Only update the screen if it's been invalidated // Only update the screen if it's been invalidated
if(myRedrawEntireFrame) if(myRedrawEntireFrame)
drawMediaSource(); drawMediaSource(true);
// Show a pause message every 5 seconds // Show a pause message every 5 seconds
if(myPausedCount++ >= 7*myOSystem->frameRate()) if(myPausedCount++ >= 7*myOSystem->frameRate())
@ -206,20 +203,12 @@ void FrameBuffer::update()
case EventHandler::S_MENU: case EventHandler::S_MENU:
{ {
// Only update the screen if it's been invalidated
if(myRedrawEntireFrame)
drawMediaSource();
myOSystem->menu().draw(); myOSystem->menu().draw();
break; // S_MENU break; // S_MENU
} }
case EventHandler::S_CMDMENU: case EventHandler::S_CMDMENU:
{ {
// Only update the screen if it's been invalidated
if(myRedrawEntireFrame)
drawMediaSource();
myOSystem->commandMenu().draw(); myOSystem->commandMenu().draw();
break; // S_CMDMENU break; // S_CMDMENU
} }
@ -262,7 +251,7 @@ void FrameBuffer::showMessage(const string& message, MessagePosition position,
if(myMsg.counter > 0) if(myMsg.counter > 0)
{ {
myRedrawEntireFrame = true; myRedrawEntireFrame = true;
myOSystem->eventHandler().refreshDisplay(); refresh();
} }
// Precompute the message coordinates // Precompute the message coordinates
@ -335,7 +324,7 @@ void FrameBuffer::showFrameStats(bool enable)
{ {
myOSystem->settings().setBool("stats", enable); myOSystem->settings().setBool("stats", enable);
myStatsMsg.enabled = enable; myStatsMsg.enabled = enable;
myOSystem->eventHandler().refreshDisplay(); refresh();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -354,8 +343,7 @@ void FrameBuffer::enableMessages(bool enable)
// Erase old messages on the screen // Erase old messages on the screen
myMsg.counter = 0; myMsg.counter = 0;
myOSystem->eventHandler().refreshDisplay(true); // Do this twice for refresh();
// myOSystem->eventHandler().refreshDisplay(true); // double-buffered modes
} }
} }
@ -373,7 +361,7 @@ inline void FrameBuffer::drawMessage()
// Either erase the entire message (when time is reached), // Either erase the entire message (when time is reached),
// or show again this frame // or show again this frame
if(myMsg.counter == 0) // Force an immediate update if(myMsg.counter == 0) // Force an immediate update
myOSystem->eventHandler().refreshDisplay(true); refresh();
else else
{ {
myMsg.surface->addDirtyRect(0, 0, 0, 0); // force a full draw myMsg.surface->addDirtyRect(0, 0, 0, 0); // force a full draw
@ -384,7 +372,72 @@ inline void FrameBuffer::drawMessage()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::refresh() void FrameBuffer::refresh()
{ {
myRedrawEntireFrame = true; cerr << "FrameBuffer::refresh() : " << myOSystem->eventHandler().state() << endl;
// This method partly duplicates the behaviour in ::update()
// Here, however, make sure to redraw *all* surfaces applicable to the
// current EventHandler state
// We also check for double-buffered modes, and when present
// update both buffers accordingly
//
// This method is in essence a FULL refresh, putting all rendering
// buffers in a known, fully redrawn state
bool doubleBuffered = (type() == kGLBuffer);
switch(myOSystem->eventHandler().state())
{
case EventHandler::S_EMULATE:
case EventHandler::S_PAUSE:
drawMediaSource(true);
if(doubleBuffered)
drawMediaSource(true);
break;
case EventHandler::S_MENU:
drawMediaSource(true);
myOSystem->menu().draw(true);
if(doubleBuffered)
{
postFrameUpdate();
drawMediaSource(true);
myOSystem->menu().draw(true);
}
break;
case EventHandler::S_CMDMENU:
drawMediaSource(true);
myOSystem->commandMenu().draw(true);
if(doubleBuffered)
{
postFrameUpdate();
drawMediaSource(true);
myOSystem->commandMenu().draw(true);
}
break;
case EventHandler::S_LAUNCHER:
myOSystem->launcher().draw(true);
if(doubleBuffered)
{
postFrameUpdate();
myOSystem->launcher().draw(true);
}
break;
#ifdef DEBUGGER_SUPPORT
case EventHandler::S_DEBUGGER:
myOSystem->debugger().draw(true);
if(doubleBuffered)
{
postFrameUpdate();
myOSystem->debugger().draw(true);
}
break;
#endif
default:
break;
}
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -533,13 +586,14 @@ bool FrameBuffer::changeVidMode(int direction)
if(!inUIMode) if(!inUIMode)
{ {
myOSystem->eventHandler().handleResizeEvent();
myOSystem->eventHandler().refreshDisplay(true);
setCursorState(); setCursorState();
showMessage(vidmode.gfxmode.description); showMessage(vidmode.gfxmode.description);
} }
if(saveModeChange) if(saveModeChange)
myOSystem->settings().setString("tia_filter", vidmode.gfxmode.name); myOSystem->settings().setString("tia_filter", vidmode.gfxmode.name);
myOSystem->eventHandler().handleResizeEvent();
refresh(); // _FIXME myOSystem->eventHandler().refreshDisplay(true);
} }
else else
return false; return false;

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: FrameBuffer.hxx,v 1.107 2008-12-20 23:32:46 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.108 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -91,7 +91,7 @@ enum {
turn drawn here as well. turn drawn here as well.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.107 2008-12-20 23:32:46 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.108 2008-12-27 23:27:32 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {
@ -187,8 +187,8 @@ class FrameBuffer
inline const GUI::Rect& screenRect() const { return myScreenRect; } inline const GUI::Rect& screenRect() const { return myScreenRect; }
/** /**
Indicates that the TIA area is dirty, and certain areas need Refresh display according to the current state, taking single vs.
to be redrawn. double-buffered modes into account, and redrawing accordingly.
*/ */
void refresh(); void refresh();
@ -372,9 +372,9 @@ class FrameBuffer
/** /**
This method should be called anytime the MediaSource needs to be redrawn This method should be called anytime the MediaSource needs to be redrawn
to the screen. to the screen (full indicating that a full redraw is required).
*/ */
virtual void drawMediaSource() = 0; virtual void drawMediaSource(bool full) = 0;
/** /**
This method is called after any drawing is done (per-frame). This method is called after any drawing is done (per-frame).
@ -549,7 +549,7 @@ class FrameBuffer
FrameBuffer type. FrameBuffer type.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.107 2008-12-20 23:32:46 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.108 2008-12-27 23:27:32 stephena Exp $
*/ */
// Text alignment modes for drawString() // Text alignment modes for drawString()
enum TextAlignment { enum TextAlignment {

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: OSystem.cxx,v 1.134 2008-12-26 20:05:17 stephena Exp $ // $Id: OSystem.cxx,v 1.135 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -275,7 +275,7 @@ void OSystem::setUIPalette()
int palette = mySettings->getInt("uipalette") - 1; int palette = mySettings->getInt("uipalette") - 1;
if(palette < 0 || palette >= kNumUIPalettes) palette = 0; if(palette < 0 || palette >= kNumUIPalettes) palette = 0;
myFrameBuffer->setUIPalette(&ourGUIColors[palette][0]); myFrameBuffer->setUIPalette(&ourGUIColors[palette][0]);
myEventHandler->refreshDisplay(); myFrameBuffer->refresh();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -477,7 +477,7 @@ bool OSystem::createLauncher()
} }
myLauncher->reStack(); myLauncher->reStack();
myFrameBuffer->setCursorState(); myFrameBuffer->setCursorState();
myEventHandler->refreshDisplay(); myFrameBuffer->refresh();
setFramerate(60); setFramerate(60);
resetLoopTiming(); resetLoopTiming();

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: CommandDialog.cxx,v 1.21 2008-12-26 20:05:17 stephena Exp $ // $Id: CommandDialog.cxx,v 1.22 2008-12-27 23:27:32 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -177,7 +177,7 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
case kSnapshotCmd: case kSnapshotCmd:
instance().eventHandler().leaveMenuMode(); instance().eventHandler().leaveMenuMode();
instance().eventHandler().refreshDisplay(true); instance().frameBuffer().refresh();
instance().eventHandler().handleEvent(Event::TakeSnapshot, 1); instance().eventHandler().handleEvent(Event::TakeSnapshot, 1);
break; break;
@ -211,6 +211,7 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
instance().console().switches().update(); instance().console().switches().update();
instance().console().mediaSource().update(); instance().console().mediaSource().update();
instance().eventHandler().handleEvent(event, 0); instance().eventHandler().handleEvent(event, 0);
instance().frameBuffer().refresh();
} }
else if(stateCmd) else if(stateCmd)
{ {

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: Dialog.cxx,v 1.71 2008-12-27 15:56:36 stephena Exp $ // $Id: Dialog.cxx,v 1.72 2008-12-27 23:27:32 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -249,7 +249,7 @@ void Dialog::drawDialog()
if(_dirty) if(_dirty)
{ {
// cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl; cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
s.fillRect(_x+1, _y+1, _w-2, _h-2, kDlgColor); s.fillRect(_x+1, _y+1, _w-2, _h-2, kDlgColor);
s.box(_x, _y, _w, _h, kColor, kShadowColor); s.box(_x, _y, _w, _h, kColor, kShadowColor);

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: DialogContainer.cxx,v 1.49 2008-12-21 19:51:35 stephena Exp $ // $Id: DialogContainer.cxx,v 1.50 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -87,10 +87,10 @@ void DialogContainer::updateTime(uInt32 time)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::draw() void DialogContainer::draw(bool full)
{ {
// Draw all the dialogs on the stack when we want a full refresh // Draw all the dialogs on the stack when we want a full refresh
if(myRefreshFlag) if(full)
{ {
for(int i = 0; i < myDialogStack.size(); i++) for(int i = 0; i < myDialogStack.size(); i++)
{ {
@ -109,10 +109,11 @@ void DialogContainer::draw()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::addDialog(Dialog* d) void DialogContainer::addDialog(Dialog* d)
{ {
cerr << "DialogContainer::addDialog : w = " << d->getWidth() << ", h = " << d->getHeight() << endl;
myDialogStack.push(d); myDialogStack.push(d);
d->open(); d->open();
d->setDirty(); // Next update() will take care of drawing
myOSystem->frameBuffer().refresh();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -124,7 +125,7 @@ void DialogContainer::removeDialog()
// We need to redraw the entire screen contents, since we don't know // We need to redraw the entire screen contents, since we don't know
// what was obscured // what was obscured
myOSystem->eventHandler().refreshDisplay(); myOSystem->frameBuffer().refresh();
} }
} }

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: DialogContainer.hxx,v 1.24 2008-02-06 13:45:23 stephena Exp $ // $Id: DialogContainer.hxx,v 1.25 2008-12-27 23:27:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef DIALOG_CONTAINER_HXX #ifndef DIALOG_CONTAINER_HXX
@ -36,7 +36,7 @@ class OSystem;
a stack, and handles their events. a stack, and handles their events.
@author Stephen Anthony @author Stephen Anthony
@version $Id: DialogContainer.hxx,v 1.24 2008-02-06 13:45:23 stephena Exp $ @version $Id: DialogContainer.hxx,v 1.25 2008-12-27 23:27:32 stephena Exp $
*/ */
class DialogContainer class DialogContainer
{ {
@ -124,9 +124,9 @@ class DialogContainer
void handleResizeEvent(); void handleResizeEvent();
/** /**
Draw the stack of menus. Draw the stack of menus (full indicates to redraw all items).
*/ */
void draw(); void draw(bool full = false);
/** /**
Add a dialog box to the stack. Add a dialog box to the stack.