gdiplus: Do not access Bitmap bits when drawing transparent pixels.

oldstable
Vincent Povirk 2015-03-17 16:09:56 -05:00 committed by Alexandre Julliard
parent b22102df40
commit 08c1e6cd96
2 changed files with 26 additions and 1 deletions

View File

@ -365,8 +365,12 @@ static GpStatus alpha_blend_bmp_pixels(GpGraphics *graphics, INT dst_x, INT dst_
for (y=0; y<src_height; y++)
{
ARGB dst_color, src_color;
GdipBitmapGetPixel(dst_bitmap, x+dst_x, y+dst_y, &dst_color);
src_color = ((ARGB*)(src + src_stride * y))[x];
if (!(src_color & 0xff000000))
continue;
GdipBitmapGetPixel(dst_bitmap, x+dst_x, y+dst_y, &dst_color);
GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over(dst_color, src_color));
}
}

View File

@ -2417,6 +2417,27 @@ static void test_fromMemoryBitmap(void)
GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap);
/* If we don't draw to the HDC, the bits are never accessed */
status = GdipCreateBitmapFromScan0(4, 4, 12, PixelFormat24bppRGB, (BYTE*)1, &bitmap);
expect(Ok, status);
status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
expect(Ok, status);
status = GdipGetDC(graphics, &hdc);
expect(Ok, status);
ok(hdc != NULL, "got NULL hdc\n");
color = GetPixel(hdc, 0, 0);
todo_wine expect(0x0c0b0d, color);
status = GdipReleaseDC(graphics, hdc);
expect(Ok, status);
GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap);
}
static void test_GdipIsVisiblePoint(void)