| 24 | } |
| 25 | |
| 26 | void SpeedGraph::AddPoint(uint64_t progressBytes, uint64_t speed) |
| 27 | { |
| 28 | auto const x = getX(progressBytes); |
| 29 | |
| 30 | auto count = Shape().Points().Size(); |
| 31 | if (count == 0) |
| 32 | { |
| 33 | Shape().Points().Append({ 0, (float)ActualHeight() }); |
| 34 | ++count; |
| 35 | } |
| 36 | |
| 37 | if (m_currentMax == 0) |
| 38 | m_currentMax = speed; |
| 39 | |
| 40 | if (count == 1) |
| 41 | { |
| 42 | Shape().Points().Append({ x, getY(speed) }); |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | if (count == 2) |
| 47 | Shape().Points().Append({ x, getY(speed) }); |
| 48 | else |
| 49 | { |
| 50 | Shape().Points().SetAt(Shape().Points().Size() - 1, { x, getY(speed) }); |
| 51 | } |
| 52 | Shape().Points().Append({ x, m_graphSize.Height }); |
| 53 | } |
| 54 | //OutputDebugString(std::format(L"{}\n", speed).data()); |
| 55 | if (m_currentMax < speed) |
| 56 | { |
| 57 | //OutputDebugString(std::format(L"max: {} -> {}\n", m_currentMax, speed).data()); |
| 58 | resizeGraphPoint(static_cast<float>(m_currentMax) / speed); |
| 59 | m_currentMax = speed; |
| 60 | } |
| 61 | |
| 62 | if (m_start == decltype(m_start){}) |
| 63 | m_start = std::chrono::steady_clock::now(); |
| 64 | |
| 65 | if (count > 2) |
| 66 | makeAnimation(); |
| 67 | } |
| 68 | |
| 69 | void SpeedGraph::SetSpeed(uint64_t speed) |
| 70 | { |