Refactor color cursor loading

This commit is contained in:
elasota
2020-01-05 04:13:00 -05:00
parent 700c31b9e4
commit 1fba6f9e85
4 changed files with 21 additions and 94 deletions

View File

@@ -89,33 +89,6 @@ CursHandle GetCursor(int cursorID)
return GetResource('CURS', cursorID).ReinterpretCast<Cursor>();
}
CCrsrHandle GetCCursor(int cursorID)
{
PortabilityLayer::HostDisplayDriver *driver = PortabilityLayer::HostDisplayDriver::GetInstance();
IGpColorCursor *hwCursor = driver->LoadColorCursor(cursorID);
if (!hwCursor)
return nullptr;
CCrsrHandle hdl = PortabilityLayer::MemoryManager::GetInstance()->NewHandle<CCursor>();
if (!hdl)
{
hwCursor->Destroy();
return nullptr;
}
CCursor *ccursor = *hdl;
ccursor->hwCursor = hwCursor;
return hdl;
}
void SetCCursor(CCrsrHandle handle)
{
assert(handle);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetColorCursor((*handle)->hwCursor);
}
void HideCursor()
{
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kHidden);
@@ -131,13 +104,6 @@ void SetBuiltinCursor(int builtinCursor)
PL_NotYetImplemented();
}
void DisposeCCursor(CCrsrHandle handle)
{
(*handle)->hwCursor->Destroy();
PortabilityLayer::MemoryManager::GetInstance()->ReleaseHandle(handle.MMBlock());
}
void Delay(int ticks, UInt32 *endTickCount)
{
PLSysCalls::Sleep(ticks);