| 1379 | } |
| 1380 | |
| 1381 | void ImGuiManager::UpdateSoftwareCursorTexture(u32 index) |
| 1382 | { |
| 1383 | SoftwareCursor& sc = s_software_cursors[index]; |
| 1384 | if (sc.image_path.empty()) |
| 1385 | { |
| 1386 | sc.texture.reset(); |
| 1387 | return; |
| 1388 | } |
| 1389 | |
| 1390 | RGBA8Image image; |
| 1391 | if (!image.LoadFromFile(sc.image_path.c_str())) |
| 1392 | { |
| 1393 | Console.Error("Failed to load software cursor %u image '%s'", index, sc.image_path.c_str()); |
| 1394 | return; |
| 1395 | } |
| 1396 | sc.texture = std::unique_ptr<GSTexture>(g_gs_device->CreateTexture(image.GetWidth(), image.GetHeight(), 1, GSTexture::Format::Color)); |
| 1397 | if (!sc.texture) |
| 1398 | { |
| 1399 | Console.Error( |
| 1400 | "Failed to upload %ux%u software cursor %u image '%s'", image.GetWidth(), image.GetHeight(), index, sc.image_path.c_str()); |
| 1401 | return; |
| 1402 | } |
| 1403 | sc.texture->Update(GSVector4i(0, 0, image.GetWidth(), image.GetHeight()), image.GetPixels(), image.GetPitch(), 0); |
| 1404 | |
| 1405 | sc.extent_x = std::ceil(static_cast<float>(image.GetWidth()) * sc.scale * s_global_scale) / 2.0f; |
| 1406 | sc.extent_y = std::ceil(static_cast<float>(image.GetHeight()) * sc.scale * s_global_scale) / 2.0f; |
| 1407 | } |
| 1408 | |
| 1409 | void ImGuiManager::DrawSoftwareCursor(const SoftwareCursor& sc, const std::pair<float, float>& pos) |
| 1410 | { |
nothing calls this directly
no test coverage detected