mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-13 07:33:53 +08:00
.
This commit is contained in:
parent
d4f16add89
commit
1ff6c2567f
@ -29,30 +29,21 @@ int GetEncoderClsid(const WCHAR *format, CLSID *pClsid)
|
||||
{
|
||||
UINT num = 0; // number of image encoders
|
||||
UINT size = 0; // size of the image encoder array in bytes
|
||||
|
||||
Gdiplus::ImageCodecInfo *pImageCodecInfo = NULL;
|
||||
|
||||
Gdiplus::GetImageEncodersSize(&num, &size);
|
||||
if (size == 0)
|
||||
return -1; // Failure
|
||||
|
||||
pImageCodecInfo = (Gdiplus::ImageCodecInfo *)(malloc(size));
|
||||
if (pImageCodecInfo == NULL)
|
||||
return -1; // Failure
|
||||
|
||||
GetImageEncoders(num, size, pImageCodecInfo);
|
||||
auto pImageCodecInfo = std::make_unique<Gdiplus::ImageCodecInfo[]>(num);
|
||||
GetImageEncoders(num, size, pImageCodecInfo.get());
|
||||
|
||||
for (UINT j = 0; j < num; ++j)
|
||||
{
|
||||
if (wcscmp(pImageCodecInfo[j].MimeType, format) == 0)
|
||||
{
|
||||
*pClsid = pImageCodecInfo[j].Clsid;
|
||||
free(pImageCodecInfo);
|
||||
return j; // Success
|
||||
}
|
||||
}
|
||||
|
||||
free(pImageCodecInfo);
|
||||
return -1; // Failure
|
||||
}
|
||||
void capture_window(HWND window_handle, void (*cb)(byte *, size_t))
|
||||
|
Loading…
x
Reference in New Issue
Block a user