Skip to content

Commit

Permalink
Minor tweaks and cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 22, 2007
1 parent 695363b commit 75983b1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/toby_wxwidgets.cpp
Expand Up @@ -42,7 +42,7 @@ class TurtleSpace : public wxWindow
inline void startRun(bool runForPrinting);
inline void stopRun();
inline const wxFont *getFont() const { return &this->font; }
inline wxBitmap *getBacking() const { return this->backing; }
inline wxBitmap *getBacking() const;
inline void scaleXY(lua_Number &x, lua_Number &y) const;
inline void putToScreen();

Expand Down Expand Up @@ -391,6 +391,13 @@ void TurtleSpace::constructBackingDC()
} // TurtleSpace::constructBackingDC


wxBitmap *TurtleSpace::getBacking() const
{
wxASSERT(this->backingDC == NULL);
return this->backing;
} // TurtleSpace::getBacking


void TurtleSpace::putToScreen()
{
this->Refresh(false);
Expand Down Expand Up @@ -653,10 +660,7 @@ bool TobyPrintout::OnPrintPage(int page)
const TobyFrame *tframe = wxGetApp().getTobyFrame();
wxASSERT(!tframe->isRunning());

const TurtleSpace *tspace = tframe->getTurtleSpace();
wxASSERT(tspace->getBackingDC() == NULL);

wxBitmap *bmp = tspace->getBacking();
wxBitmap *bmp = tframe->getTurtleSpace()->getBacking();
if (bmp != NULL)
{
wxDC *dc = this->GetDC();
Expand Down Expand Up @@ -791,12 +795,10 @@ bool TobyFrame::pumpEvents()
{
if (this->pumpStopwatch.Time() > 50)
{
TurtleSpace *tspace = this->getTurtleSpace();

// force repaint here...this means we will be clamped to 20fps, but
// the overall execution of the program will be much faster, as
// rendering primitives will batch.
tspace->putToScreen();
this->turtleSpace->putToScreen();

// Pump the system event queue if we aren't requesting a program halt.
while ((!this->stopRequested()) && (wxGetApp().Pending()))
Expand Down

0 comments on commit 75983b1

Please sign in to comment.