Win32 C90 Fixes

This commit is contained in:
GamesTrap 2023-04-05 20:58:00 +02:00
parent 76951dbbf3
commit d7cc6477ae
No known key found for this signature in database
GPG Key ID: 31DFD452434ECDA3

View File

@ -1727,24 +1727,20 @@ static HICON GenerateTextBadgeIcon(HWND hWnd, WCHAR* text)
int fontSize = 16, weight = FW_REGULAR; int fontSize = 16, weight = FW_REGULAR;
RECT contentRect = { 0, 0, width, height }; RECT contentRect = { 0, 0, width, height };
HICON hIcon = NULL; HICON hIcon = NULL;
BITMAPINFO bmi = {0};
int x = 0, y = 0;
memset(&badgeData, 0, sizeof(BadgeData)); memset(&badgeData, 0, sizeof(BadgeData));
if (!text) if (!text)
return NULL; return NULL;
BITMAPINFO bmi = bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
{ bmi.bmiHeader.biWidth = width;
.bmiHeader = bmi.bmiHeader.biHeight = height;
{ bmi.bmiHeader.biPlanes = 1;
.biSize = sizeof(BITMAPINFOHEADER), bmi.bmiHeader.biBitCount = 32;
.biWidth = width, bmi.bmiHeader.biCompression = BI_RGB;
.biHeight = height,
.biPlanes = 1,
.biBitCount = 32,
.biCompression = BI_RGB
}
};
badgeData.hdc = GetDC(hWnd); badgeData.hdc = GetDC(hWnd);
if(!badgeData.hdc) if(!badgeData.hdc)
@ -1856,11 +1852,11 @@ static HICON GenerateTextBadgeIcon(HWND hWnd, WCHAR* text)
} }
//Transparency //Transparency
for (int y = 0; y < height; ++y) for (y = 0; y < height; ++y)
{ {
for (int x = 0; x < width; ++x) for (x = 0; x < width; ++x)
{ {
DWORD pixel = pixels[y * width + x]; const DWORD pixel = pixels[y * width + x];
if (pixel == 0x0026252Du || pixel == 0x00FFFFFFu) //Pixel is text or ellipsis if (pixel == 0x0026252Du || pixel == 0x00FFFFFFu) //Pixel is text or ellipsis
pixels[y * width + x] |= 0xFF000000u; //Set opaque pixels[y * width + x] |= 0xFF000000u; //Set opaque
else else
@ -1895,21 +1891,17 @@ static HICON GenerateGenericBadgeIcon(HWND hWnd)
ICONINFO iconInfo; ICONINFO iconInfo;
int width = 32, height = 32; int width = 32, height = 32;
HICON hIcon = NULL; HICON hIcon = NULL;
BITMAPINFO bmi;
int x = 0, y = 0;
memset(&badgeData, 0, sizeof(BadgeData)); memset(&badgeData, 0, sizeof(BadgeData));
BITMAPINFO bmi = bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
{ bmi.bmiHeader.biWidth = width;
.bmiHeader = bmi.bmiHeader.biHeight = height;
{ bmi.bmiHeader.biPlanes = 1;
.biSize = sizeof(BITMAPINFOHEADER), bmi.bmiHeader.biBitCount = 32;
.biWidth = width, bmi.bmiHeader.biCompression = BI_RGB;
.biHeight = height,
.biPlanes = 1,
.biBitCount = 32,
.biCompression = BI_RGB
}
};
badgeData.hdc = GetDC(hWnd); badgeData.hdc = GetDC(hWnd);
if (!badgeData.hdc) if (!badgeData.hdc)
@ -1992,11 +1984,11 @@ static HICON GenerateGenericBadgeIcon(HWND hWnd)
badgeData.hOldBitmapMask = NULL; badgeData.hOldBitmapMask = NULL;
//Transparency //Transparency
for (int y = 0; y < height; ++y) for (y = 0; y < height; ++y)
{ {
for (int x = 0; x < width; ++x) for (x = 0; x < width; ++x)
{ {
DWORD pixel = pixels[y * width + x]; const DWORD pixel = pixels[y * width + x];
if (pixel >= 0x00010101u) //Pixel is ellipsis if (pixel >= 0x00010101u) //Pixel is ellipsis
pixels[y * width + x] |= 0xFF000000u; //Set opaque pixels[y * width + x] |= 0xFF000000u; //Set opaque
else else
@ -2042,7 +2034,7 @@ void _glfwSetWindowBadgeWin32(_GLFWwindow* window, int count)
return; return;
} }
count = min(count, 999); count = _glfw_min(count, 999);
if (count > 0) if (count > 0)
{ {
if (window->win32.genericBadge) if (window->win32.genericBadge)