gdiplus: GdipGetDC doesn't set the alpha channel for a 32-bit dib.

This commit is contained in:
Vincent Povirk 2015-03-18 15:52:18 -05:00 committed by Alexandre Julliard
parent 069406fe94
commit e9d9ef591b
2 changed files with 18 additions and 2 deletions

View File

@ -5713,7 +5713,7 @@ GpStatus WINGDIPAPI GdipGetDC(GpGraphics *graphics, HDC *hdc)
{
stat = METAFILE_GetDC((GpMetafile*)graphics->image, hdc);
}
else if (!graphics->hdc || graphics->alpha_hdc ||
else if (!graphics->hdc ||
(graphics->image && graphics->image->type == ImageTypeBitmap && ((GpBitmap*)graphics->image)->format & PixelFormatAlpha))
{
/* Create a fake HDC and fill it with a constant color. */

View File

@ -4445,12 +4445,13 @@ static void test_measured_extra_space(void)
static void test_alpha_hdc(void)
{
GpStatus status;
HDC hdc;
HDC hdc, gp_hdc;
HBITMAP hbm, old_hbm;
GpGraphics *graphics;
ULONG *bits;
BITMAPINFO bmi;
GpRectF bounds;
COLORREF colorref;
hdc = CreateCompatibleDC(0);
ok(hdc != NULL, "CreateCompatibleDC failed\n");
@ -4484,6 +4485,21 @@ static void test_alpha_hdc(void)
expect(0xffaaaaaa, bits[0]);
bits[0] = 0xdeadbeef;
status = GdipGetDC(graphics, &gp_hdc);
expect(Ok, status);
colorref = GetPixel(gp_hdc, 0, 4);
expect(0xefbead, colorref);
SetPixel(gp_hdc, 0, 4, 0xffffff);
expect(0xffffff, bits[0]);
status = GdipReleaseDC(graphics, gp_hdc);
expect(Ok, status);
SelectObject(hdc, old_hbm);
bits[0] = 0xdeadbeef;