| 106 | } |
| 107 | |
| 108 | bool OverlayTree::Frame() |
| 109 | { |
| 110 | if (IsNeedUpdate()) |
| 111 | return true; |
| 112 | |
| 113 | // Choose optimal frame update period. |
| 114 | if (m_frameCounter == 0) |
| 115 | { |
| 116 | auto const handlesCount = m_handlesCache.size(); |
| 117 | if (handlesCount > kMaxHandlesCount) |
| 118 | m_frameUpdatePeriod = kMaxFrameUpdatePeriod; |
| 119 | else if (handlesCount < kMinHandlesCount) |
| 120 | m_frameUpdatePeriod = kMinFrameUpdatePeriod; |
| 121 | else |
| 122 | m_frameUpdatePeriod = kAvgFrameUpdatePeriod; |
| 123 | } |
| 124 | |
| 125 | m_frameCounter++; |
| 126 | if (m_frameCounter >= static_cast<int>(m_frameUpdatePeriod)) |
| 127 | InvalidateOnNextFrame(); |
| 128 | |
| 129 | return IsNeedUpdate(); |
| 130 | } |
| 131 | |
| 132 | bool OverlayTree::IsNeedUpdate() const |
| 133 | { |
no test coverage detected