# HG changeset patch # User MJP # Date 1392302191 -3600 # Thu Feb 13 15:36:31 2014 +0100 # Node ID 51b04aaa85e08c2b656c5ee63306587d03db06e6 # Parent 32b2308512d03fc964bcb3b894c13c5a27cb4307 Update linkgraph only if needed diff -r 32b2308512d0 -r 51b04aaa85e0 src/main_gui.cpp --- a/src/main_gui.cpp Tue Feb 11 21:17:43 2014 +0000 +++ b/src/main_gui.cpp Thu Feb 13 15:36:31 2014 +0100 @@ -254,8 +254,10 @@ virtual void OnTick() { if (--refresh == 0) { - this->viewport->overlay->RebuildCache(); - this->GetWidget(WID_M_VIEWPORT)->SetDirty(this); + if (this->viewport->overlay->GetCargoMask()) { + this->viewport->overlay->RebuildCache(); + this->GetWidget(WID_M_VIEWPORT)->SetDirty(this); + } this->refresh = LINKGRAPH_REFRESH_PERIOD; } } diff -r 32b2308512d0 -r 51b04aaa85e0 src/viewport.cpp --- a/src/viewport.cpp Tue Feb 11 21:17:43 2014 +0000 +++ b/src/viewport.cpp Thu Feb 13 15:36:31 2014 +0100 @@ -1477,13 +1477,14 @@ dp.height = UnScaleByZoom(dp.height, zoom); _cur_dpi = &dp; - /* translate to window coordinates */ - dp.left = x; - dp.top = y; - - if (vp->overlay != NULL) vp->overlay->Draw(&dp); - - /* translate back to world coordinates */ + if (vp->overlay != NULL && vp->overlay->GetCargoMask() != 0) { + /* Translate to window coordinates. */ + dp.left = x; + dp.top = y; + vp->overlay->Draw(&dp); + } + + /* Translate back to world coordinates. */ dp.left = UnScaleByZoom(_vd.dpi.left, zoom); dp.top = UnScaleByZoom(_vd.dpi.top, zoom);