mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-11 09:39:09 -04:00
Formating review, using imperative mode in comments
This commit is contained in:
18
src/external/win32_clipboard.h
vendored
18
src/external/win32_clipboard.h
vendored
@ -181,7 +181,7 @@ typedef struct tagRGBQUAD {
|
||||
#endif
|
||||
|
||||
#ifndef BI_ALPHABITFIELDS
|
||||
// Bitmap not compressed and that the color table consists of four DWORD color masks,
|
||||
// Bitmap not compressed and that the color table consists of four DWORD color masks,
|
||||
// that specify the red, green, blue, and alpha components of each pixel
|
||||
#define BI_ALPHABITFIELDS 0x0006
|
||||
#endif
|
||||
@ -216,7 +216,7 @@ static int GetPixelDataOffset(BITMAPINFOHEADER bih); // Get pixel data offset fr
|
||||
unsigned char *Win32GetClipboardImageData(int *width, int *height, unsigned long long int *dataSize)
|
||||
{
|
||||
unsigned char *bmpData = NULL;
|
||||
|
||||
|
||||
if (OpenClipboardRetrying(NULL))
|
||||
{
|
||||
HGLOBAL clipHandle = (HGLOBAL)GetClipboardData(CF_DIB);
|
||||
@ -231,7 +231,7 @@ unsigned char *Win32GetClipboardImageData(int *width, int *height, unsigned long
|
||||
if (clipDataSize >= sizeof(BITMAPINFOHEADER))
|
||||
{
|
||||
int pixelOffset = GetPixelDataOffset(*bmpInfoHeader);
|
||||
|
||||
|
||||
// Create the bytes for a correct BMP file and copy the data to a pointer
|
||||
//------------------------------------------------------------------------
|
||||
BITMAPFILEHEADER bmpFileHeader = { 0 };
|
||||
@ -245,10 +245,10 @@ unsigned char *Win32GetClipboardImageData(int *width, int *height, unsigned long
|
||||
bmpData = (unsigned char *)RL_MALLOC(sizeof(bmpFileHeader) + clipDataSize);
|
||||
memcpy(bmpData, &bmpFileHeader, sizeof(bmpFileHeader)); // Add BMP file header data
|
||||
memcpy(bmpData + sizeof(bmpFileHeader), bmpInfoHeader, clipDataSize); // Add BMP info header data
|
||||
|
||||
|
||||
GlobalUnlock(clipHandle);
|
||||
CloseClipboard();
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "Clipboad image acquired successfully");
|
||||
//------------------------------------------------------------------------
|
||||
}
|
||||
@ -259,14 +259,14 @@ unsigned char *Win32GetClipboardImageData(int *width, int *height, unsigned long
|
||||
CloseClipboard();
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "Clipboard data failed to be locked");
|
||||
GlobalUnlock(clipHandle);
|
||||
CloseClipboard();
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "Clipboard data is not an image");
|
||||
CloseClipboard();
|
||||
@ -286,7 +286,7 @@ static BOOL OpenClipboardRetrying(HWND hWnd)
|
||||
{
|
||||
static const int maxTries = 20;
|
||||
static const int sleepTimeMS = 60;
|
||||
|
||||
|
||||
for (int i = 0; i < maxTries; i++)
|
||||
{
|
||||
// Might be being hold by another process
|
||||
@ -295,7 +295,7 @@ static BOOL OpenClipboardRetrying(HWND hWnd)
|
||||
|
||||
Sleep(sleepTimeMS);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user