gdiplus: Do not access Bitmap bits when drawing transparent pixels.
This commit is contained in:
parent
b22102df40
commit
08c1e6cd96
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue