MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / ImageViewerOnLoad

Function ImageViewerOnLoad

src/windows/ImageViewer.cpp:309–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void ImageViewerOnLoad(NetRequest* pRequest)
310{
311 if (pRequest->result != HTTP_OK)
312 {
313 DownloadOnRequestFail(g_ivHwnd, pRequest);
314 KillImageViewer();
315 return;
316 }
317
318 // Since the response is passed in as a string, this could do for getting the binary stuff out of it
319 const uint8_t* pData = (const uint8_t*)pRequest->response.data();
320 const size_t nSize = pRequest->response.size();
321
322 KillImageBitmaps();
323
324 bool unusedHasAlpha1 = false;
325 bool unusedHasAlpha2 = false;
326 HImage* imFull = ImageLoader::ConvertToBitmap(pData, nSize, unusedHasAlpha1, false, 0, 0);
327 HImage* imPreview = ImageLoader::ConvertToBitmap(pData, nSize, unusedHasAlpha2, false, g_ivPreviewImageWidth, g_ivPreviewImageHeight);
328
329 g_hBitmapFull = imFull;
330 g_hBitmapPreview = imPreview;
331
332 g_bChildZoomedIn = false;
333 SendMessage(g_ivChildHwnd, WM_UPDATEBITMAP, 0, 0);
334}
335
336void ImageViewerRequestSave()
337{

Callers 1

ImageViewerWndProcFunction · 0.85

Calls 5

DownloadOnRequestFailFunction · 0.85
KillImageViewerFunction · 0.85
KillImageBitmapsFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected