Skip to content

Commit

Permalink
rework
Browse files Browse the repository at this point in the history
  • Loading branch information
qbnu committed Jun 23, 2024
1 parent bbb1f86 commit 0ec60fa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/JPEGView/ImageLoadThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,11 @@ void CImageLoadThread::ProcessReadJPEGRequest(CRequest * request) {
unsigned int nNumBytesRead;
if (::ReadFile(hFile, pBuffer, nFileSize, (LPDWORD) &nNumBytesRead, NULL) && nNumBytesRead == nFileSize) {
bool bUseGDIPlus = CSettingsProvider::This().ForceGDIPlus() || CSettingsProvider::This().UseEmbeddedColorProfiles();
bool isOutOfMemory = false;
if (bUseGDIPlus) {
IStream* pStream = NULL;
if (::CreateStreamOnHGlobal(hFileBuffer, FALSE, &pStream) == S_OK) {
Gdiplus::Bitmap* pBitmap = Gdiplus::Bitmap::FromStream(pStream, CSettingsProvider::This().UseEmbeddedColorProfiles());
bool isAnimatedGIF;
bool isOutOfMemory, isAnimatedGIF;
request->Image = ConvertGDIPlusBitmapToJPEGImage(pBitmap, 0, Helpers::FindEXIFBlock(pBuffer, nFileSize),
Helpers::CalculateJPEGFileHash(pBuffer, nFileSize), isOutOfMemory, isAnimatedGIF);
request->OutOfMemory = request->Image == NULL && isOutOfMemory;
Expand All @@ -516,7 +515,7 @@ void CImageLoadThread::ProcessReadJPEGRequest(CRequest * request) {
request->OutOfMemory = true;
}
}
if (!bUseGDIPlus || isOutOfMemory) {
if (!bUseGDIPlus || request->OutOfMemory) {
int nWidth, nHeight, nBPP;
TJSAMP eChromoSubSampling;
bool bOutOfMemory;
Expand Down

0 comments on commit 0ec60fa

Please sign in to comment.