Module: wine Branch: master Commit: e9d9ef591b490a8b4eb173df34b10a6977f45b6d URL: http://source.winehq.org/git/wine.git/?a=commit;h=e9d9ef591b490a8b4eb173df34...
Author: Vincent Povirk vincent@codeweavers.com Date: Wed Mar 18 15:52:18 2015 -0500
gdiplus: GdipGetDC doesn't set the alpha channel for a 32-bit dib.
---
dlls/gdiplus/graphics.c | 2 +- dlls/gdiplus/tests/graphics.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 6d86e3a..5284b99 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -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. */ diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index e0bd615..77de9e4 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -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;