| 228 | } |
| 229 | |
| 230 | void ConsoleComputeApp::Present(ftxui::Canvas& canvas) |
| 231 | { |
| 232 | META_FUNCTION_TASK(); |
| 233 | const data::FrameSize& field_size = GetFieldSize(); |
| 234 | const data::FrameRect& frame_rect = GetVisibleFrameRect(); |
| 235 | const uint8_t* cells = m_frame_data.GetDataPtr<uint8_t>(); |
| 236 | m_visible_cells_count = 0U; |
| 237 | |
| 238 | for (uint32_t y = 0; y < frame_rect.size.GetHeight(); y++) |
| 239 | { |
| 240 | const uint32_t cell_y = frame_rect.origin.GetY() + y; |
| 241 | const uint32_t cell_shift = cell_y * field_size.GetWidth(); |
| 242 | for (uint32_t x = 0; x < frame_rect.size.GetWidth(); x++) |
| 243 | { |
| 244 | const uint32_t cell_x = frame_rect.origin.GetX() + x; |
| 245 | if (cells[cell_shift + cell_x]) |
| 246 | { |
| 247 | canvas.DrawBlockOn(static_cast<int>(x), static_cast<int>(y)); |
| 248 | m_visible_cells_count++; |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | m_fps_counter.OnCpuFramePresented(); |
| 253 | } |
| 254 | |
| 255 | void ConsoleComputeApp::Restart() |
| 256 | { |
no test coverage detected