gdiplus: Fix crash if failed to create bitmap.

Signed-off-by: Jiajin Cui <cuijiajin@uniontech.com>
Signed-off-by: Esme Povirk <esme@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jiajin Cui 2020-07-17 17:34:09 +08:00 committed by Alexandre Julliard
parent 5df591fe01
commit f992bc77c8
1 changed files with 7 additions and 1 deletions

View File

@ -459,6 +459,9 @@ static GpStatus alpha_blend_hdc_pixels(GpGraphics *graphics, INT dst_x, INT dst_
hbitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bih, DIB_RGB_COLORS, hbitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bih, DIB_RGB_COLORS,
(void**)&temp_bits, NULL, 0); (void**)&temp_bits, NULL, 0);
if(!hbitmap || !temp_bits)
goto done;
if ((GetDeviceCaps(graphics->hdc, TECHNOLOGY) == DT_RASPRINTER && if ((GetDeviceCaps(graphics->hdc, TECHNOLOGY) == DT_RASPRINTER &&
GetDeviceCaps(graphics->hdc, SHADEBLENDCAPS) == SB_NONE) || GetDeviceCaps(graphics->hdc, SHADEBLENDCAPS) == SB_NONE) ||
fmt & PixelFormatPAlpha) fmt & PixelFormatPAlpha)
@ -470,9 +473,12 @@ static GpStatus alpha_blend_hdc_pixels(GpGraphics *graphics, INT dst_x, INT dst_
SelectObject(hdc, hbitmap); SelectObject(hdc, hbitmap);
gdi_alpha_blend(graphics, dst_x, dst_y, src_width, src_height, gdi_alpha_blend(graphics, dst_x, dst_y, src_width, src_height,
hdc, 0, 0, src_width, src_height); hdc, 0, 0, src_width, src_height);
DeleteDC(hdc);
DeleteObject(hbitmap); DeleteObject(hbitmap);
done:
DeleteDC(hdc);
return Ok; return Ok;
} }