Commit 517059f3 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Set bitmap has alpha flag based on format.

parent 18a4e243
...@@ -1742,6 +1742,10 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, ...@@ -1742,6 +1742,10 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
(*bitmap)->stride = dib_stride; (*bitmap)->stride = dib_stride;
(*bitmap)->own_bits = own_bits; (*bitmap)->own_bits = own_bits;
/* set format-related flags */
if (format & (PixelFormatAlpha|PixelFormatPAlpha|PixelFormatIndexed))
(*bitmap)->image.flags |= ImageFlagsHasAlpha;
if (format == PixelFormat1bppIndexed || if (format == PixelFormat1bppIndexed ||
format == PixelFormat4bppIndexed || format == PixelFormat4bppIndexed ||
format == PixelFormat8bppIndexed) format == PixelFormat8bppIndexed)
......
...@@ -734,6 +734,115 @@ static void test_GdipGetImageFlags(void) ...@@ -734,6 +734,115 @@ static void test_GdipGetImageFlags(void)
stat = GdipGetImageFlags(img, NULL); stat = GdipGetImageFlags(img, NULL);
expect(InvalidParameter, stat); expect(InvalidParameter, stat);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat1bppIndexed, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat4bppIndexed, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat8bppIndexed, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppGrayScale, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsNone, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppRGB555, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsNone, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppRGB565, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsNone, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppARGB1555, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsNone, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat32bppRGB, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsNone, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat32bppARGB, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat32bppPARGB, NULL, (GpBitmap**)&img);
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat48bppRGB, NULL, (GpBitmap**)&img);
expect(Ok, stat);
if (stat == Ok)
{
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsNone, flags);
GdipDisposeImage(img);
}
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppARGB, NULL, (GpBitmap**)&img);
expect(Ok, stat);
if (stat == Ok)
{
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
}
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppPARGB, NULL, (GpBitmap**)&img);
expect(Ok, stat);
if (stat == Ok)
{
expect(Ok, stat);
stat = GdipGetImageFlags(img, &flags);
expect(Ok, stat);
expect(ImageFlagsHasAlpha, flags);
GdipDisposeImage(img);
}
} }
static void test_GdipCloneImage(void) static void test_GdipCloneImage(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment