gdiplus: Better error checking in GdipBitmapLockBits.
This commit is contained in:
parent
96a69f0508
commit
ff752456e1
|
@ -142,16 +142,20 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
|
||||||
stride = (stride + 3) & ~3;
|
stride = (stride + 3) & ~3;
|
||||||
|
|
||||||
buff = GdipAlloc(stride * abs_height);
|
buff = GdipAlloc(stride * abs_height);
|
||||||
if(!buff) return OutOfMemory;
|
|
||||||
|
|
||||||
bmi.bmiHeader.biBitCount = bitspp;
|
bmi.bmiHeader.biBitCount = bitspp;
|
||||||
GetDIBits(hdc, (HBITMAP)hbm, 0, abs_height, buff, &bmi, DIB_RGB_COLORS);
|
|
||||||
|
if(buff)
|
||||||
|
GetDIBits(hdc, (HBITMAP)hbm, 0, abs_height, buff, &bmi, DIB_RGB_COLORS);
|
||||||
|
|
||||||
if(!bm_is_selected){
|
if(!bm_is_selected){
|
||||||
SelectObject(hdc, old);
|
SelectObject(hdc, old);
|
||||||
DeleteDC(hdc);
|
DeleteDC(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!buff)
|
||||||
|
return OutOfMemory;
|
||||||
|
|
||||||
lockeddata->Width = rect->Width;
|
lockeddata->Width = rect->Width;
|
||||||
lockeddata->Height = rect->Height;
|
lockeddata->Height = rect->Height;
|
||||||
lockeddata->PixelFormat = format;
|
lockeddata->PixelFormat = format;
|
||||||
|
|
Loading…
Reference in New Issue