mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 23:31:45 +00:00
Add SDL_GetWindowICCProfile(). (#4314)
* Add SDL_GetWindowICCProfile * Add new SDL display events * Implement ICC profile change event for macOS * Implement ICC profile notification for Windows * Fix SDL_GetWindowICCProfile() for X11 * Fix compile errors
This commit is contained in:
@@ -725,6 +725,32 @@ WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
|
||||
return succeeded ? 0 : -1;
|
||||
}
|
||||
|
||||
void*
|
||||
WIN_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size)
|
||||
{
|
||||
SDL_VideoDisplay* display = SDL_GetDisplayForWindow(window);
|
||||
SDL_DisplayData* data = (SDL_DisplayData*)display->driverdata;
|
||||
HDC hdc;
|
||||
BOOL succeeded = FALSE;
|
||||
WCHAR filename[MAX_PATH];
|
||||
DWORD fileNameSize = MAX_PATH;
|
||||
void* iccProfileData = NULL;
|
||||
|
||||
hdc = CreateDCW(data->DeviceName, NULL, NULL, NULL);
|
||||
if (hdc) {
|
||||
succeeded = GetICMProfileW(hdc, &fileNameSize, filename);
|
||||
DeleteDC(hdc);
|
||||
}
|
||||
|
||||
if (succeeded) {
|
||||
iccProfileData = SDL_LoadFile(WIN_StringToUTF8(filename), size);
|
||||
if (!iccProfileData)
|
||||
SDL_SetError("Could not open ICC profile");
|
||||
}
|
||||
|
||||
return iccProfileData;
|
||||
}
|
||||
|
||||
int
|
||||
WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp)
|
||||
{
|
||||
|
Reference in New Issue
Block a user