@@ -190,14 +190,17 @@ static CJPEGImage* ConvertGDIPlusBitmapToJPEGImage(Gdiplus::Bitmap* pBitmap, int
190
190
191
191
Gdiplus::Rect bmRect (0 , 0 , pBitmap->GetWidth (), pBitmap->GetHeight ());
192
192
Gdiplus::BitmapData bmData;
193
- if (pBitmapToUse->LockBits (&bmRect, Gdiplus::ImageLockModeRead, PixelFormat32bppRGB, &bmData) == Gdiplus::Ok) {
193
+ lastStatus = pBitmapToUse->LockBits (&bmRect, Gdiplus::ImageLockModeRead, PixelFormat32bppRGB, &bmData);
194
+ if (lastStatus == Gdiplus::Ok) {
194
195
assert (bmData.PixelFormat == PixelFormat32bppRGB);
195
196
void * pDIB = CBasicProcessing::ConvertGdiplus32bppRGB (bmRect.Width , bmRect.Height , bmData.Stride , bmData.Scan0 );
196
197
if (pDIB != NULL ) {
197
198
pJPEGImage = new CJPEGImage (bmRect.Width , bmRect.Height , pDIB, pEXIFData, 4 , nJPEGHash, eImageFormat,
198
199
eImageFormat == IF_GIF && nFrameCount > 1 , nFrameIndex, nFrameCount, nFrameTimeMs);
199
200
}
200
201
pBitmapToUse->UnlockBits (&bmData);
202
+ } else if (lastStatus == Gdiplus::ValueOverflow) {
203
+ isOutOfMemory = true ;
201
204
}
202
205
203
206
if (pBmGraphics != NULL && pBmTarget != NULL ) {
@@ -695,7 +698,7 @@ void CImageLoadThread::ProcessReadPNGRequest(CRequest* request) {
695
698
#ifndef WINXP
696
699
// If UseEmbeddedColorProfiles is true and the image isn't animated, we should use GDI+ for better color management
697
700
bool bUseGDIPlus = CSettingsProvider::This ().ForceGDIPlus () || CSettingsProvider::This ().UseEmbeddedColorProfiles ();
698
- if (bUseCachedDecoder || !bUseGDIPlus || PngReader::IsAnimated (pBuffer, nFileSize))
701
+ if (bUseCachedDecoder || !bUseGDIPlus || PngReader::MustUseLibpng (pBuffer, nFileSize))
699
702
pPixelData = (uint8*)PngReader::ReadImage (nWidth, nHeight, nBPP, bHasAnimation, nFrameCount, nFrameTimeMs, pEXIFData, request->OutOfMemory , pBuffer, nFileSize);
700
703
#endif
701
704
0 commit comments