forked from elasota/Aerofoil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
1,311 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
#include "GpColorCursor_Win32.h" | ||
#include "GpCursor_Win32.h" | ||
|
||
#include <stdlib.h> | ||
#include <new> | ||
|
||
void GpColorCursor_Win32::Destroy() | ||
void GpCursor_Win32::Destroy() | ||
{ | ||
this->DecRef(); | ||
} | ||
|
||
IGpColorCursor_Win32 *GpColorCursor_Win32::Load(const wchar_t *path) | ||
IGpCursor_Win32 *GpCursor_Win32::Load(const wchar_t *path) | ||
{ | ||
HANDLE imageH = LoadImageW(nullptr, path, IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE); | ||
|
||
if (imageH == nullptr) | ||
return nullptr; | ||
|
||
HCURSOR cursor = reinterpret_cast<HCURSOR>(imageH); | ||
void *storage = malloc(sizeof(GpColorCursor_Win32)); | ||
void *storage = malloc(sizeof(GpCursor_Win32)); | ||
if (!storage) | ||
{ | ||
DestroyCursor(cursor); | ||
return nullptr; | ||
} | ||
|
||
return new (storage) GpColorCursor_Win32(reinterpret_cast<HCURSOR>(cursor)); | ||
return new (storage) GpCursor_Win32(reinterpret_cast<HCURSOR>(cursor)); | ||
} | ||
|
||
GpColorCursor_Win32::GpColorCursor_Win32(HCURSOR cursor) | ||
GpCursor_Win32::GpCursor_Win32(HCURSOR cursor) | ||
: m_cursor(cursor) | ||
, m_refCount(1) | ||
{ | ||
} | ||
|
||
GpColorCursor_Win32::~GpColorCursor_Win32() | ||
GpCursor_Win32::~GpCursor_Win32() | ||
{ | ||
DestroyCursor(m_cursor); | ||
} | ||
|
||
const HCURSOR &GpColorCursor_Win32::GetHCursor() const | ||
const HCURSOR &GpCursor_Win32::GetHCursor() const | ||
{ | ||
return m_cursor; | ||
} | ||
|
||
void GpColorCursor_Win32::IncRef() | ||
void GpCursor_Win32::IncRef() | ||
{ | ||
m_refCount++; | ||
} | ||
|
||
void GpColorCursor_Win32::DecRef() | ||
void GpCursor_Win32::DecRef() | ||
{ | ||
m_refCount--; | ||
if (m_refCount == 0) | ||
{ | ||
this->~GpColorCursor_Win32(); | ||
this->~GpCursor_Win32(); | ||
free(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.