mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Thumbnail providers] Cover errors and edge cases (#23947)
* [Thumbnail providers] Cover errors and edge cases * Add TODO comment * Fix tests
This commit is contained in:
@@ -158,10 +158,18 @@ IFACEMETHODIMP SvgThumbnailProvider::GetThumbnail(UINT cx, HBITMAP* phbmp, WTS_A
|
||||
std::filesystem::remove(fileName);
|
||||
|
||||
std::wstring fileNameBmp = filePath + guid + L".bmp";
|
||||
*phbmp = (HBITMAP)LoadImage(NULL, fileNameBmp.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
||||
*pdwAlpha = WTS_ALPHATYPE::WTSAT_ARGB;
|
||||
|
||||
std::filesystem::remove(fileNameBmp);
|
||||
if (std::filesystem::exists(fileNameBmp))
|
||||
{
|
||||
*phbmp = (HBITMAP)LoadImage(NULL, fileNameBmp.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
||||
*pdwAlpha = WTS_ALPHATYPE::WTSAT_ARGB;
|
||||
std::filesystem::remove(fileNameBmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::info(L"Bmp file not generated.");
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
// IInitializeWithStream
|
||||
IFACEMETHODIMP Initialize(IStream* pstream, DWORD grfMode);
|
||||
|
||||
// IPreviewHandler
|
||||
// IThumbnailProvider
|
||||
IFACEMETHODIMP GetThumbnail(UINT cx, HBITMAP* phbmp, WTS_ALPHATYPE* pdwAlpha);
|
||||
|
||||
SvgThumbnailProvider();
|
||||
|
||||
Reference in New Issue
Block a user