MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / UpdateSoftwareCursorTexture

Method UpdateSoftwareCursorTexture

pcsx2/ImGui/ImGuiManager.cpp:1381–1407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1379}
1380
1381void 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
1409void ImGuiManager::DrawSoftwareCursor(const SoftwareCursor& sc, const std::pair<float, float>& pos)
1410{

Callers

nothing calls this directly

Calls 13

LoadFromFileMethod · 0.80
CreateTextureMethod · 0.80
GSVector4iClass · 0.50
ceilFunction · 0.50
emptyMethod · 0.45
resetMethod · 0.45
c_strMethod · 0.45
ErrorMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45
UpdateMethod · 0.45
GetPixelsMethod · 0.45

Tested by

no test coverage detected