Commit d104741a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdiplus: Add support for converting RGB formats to 1bpp indexed.

parent 2ed1aaa9
...@@ -637,6 +637,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -637,6 +637,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppGrayScale, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppGrayScale, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_16bppGrayScale, setpixel_8bppIndexed);
case PixelFormat16bppRGB555: case PixelFormat16bppRGB555:
...@@ -664,6 +666,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -664,6 +666,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppRGB555: case PixelFormat16bppRGB555:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB555, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB555, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_16bppRGB555, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -691,6 +695,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -691,6 +695,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppRGB565: case PixelFormat16bppRGB565:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB565, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB565, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_16bppRGB565, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -718,6 +724,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -718,6 +724,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppARGB1555: case PixelFormat16bppARGB1555:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppARGB1555, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppARGB1555, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_16bppARGB1555, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -745,6 +753,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -745,6 +753,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat24bppRGB: case PixelFormat24bppRGB:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_24bppRGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_24bppRGB, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_24bppRGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -772,6 +782,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -772,6 +782,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat32bppRGB: case PixelFormat32bppRGB:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_32bppRGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_32bppRGB, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_32bppRGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -799,6 +811,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -799,6 +811,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat32bppARGB: case PixelFormat32bppARGB:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_32bppARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_32bppARGB, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_32bppARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -825,6 +839,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -825,6 +839,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat32bppPARGB: case PixelFormat32bppPARGB:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_32bppPARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_32bppPARGB, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_32bppPARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -852,6 +868,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -852,6 +868,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat48bppRGB: case PixelFormat48bppRGB:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_48bppRGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_48bppRGB, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_48bppRGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -879,6 +897,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -879,6 +897,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat64bppARGB: case PixelFormat64bppARGB:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_64bppARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_64bppARGB, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_64bppARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
...@@ -906,6 +926,8 @@ GpStatus convert_pixels(INT width, INT height, ...@@ -906,6 +926,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat64bppPARGB: case PixelFormat64bppPARGB:
switch (dst_format) switch (dst_format)
{ {
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_64bppPARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed: case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_64bppPARGB, setpixel_8bppIndexed); convert_rgb_to_indexed(getpixel_64bppPARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale: case PixelFormat16bppGrayScale:
......
...@@ -3404,7 +3404,6 @@ static void test_bitmapbits(void) ...@@ -3404,7 +3404,6 @@ static void test_bitmapbits(void)
0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77, 0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77 0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77
}; };
#if 0 /* FIXME: these tests crash gdiplus in Wine */
static const BYTE pixels_1_77[64] = static const BYTE pixels_1_77[64] =
{ {
0xaa,0x77,0x77,0x77,0x77,0x77,0x77,0x77, 0xaa,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
...@@ -3417,7 +3416,6 @@ static void test_bitmapbits(void) ...@@ -3417,7 +3416,6 @@ static void test_bitmapbits(void)
0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77 0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77
}; };
static const BYTE pixels_1[8] = {0xaa,0,0,0,0xaa,0,0,0}; static const BYTE pixels_1[8] = {0xaa,0,0,0,0xaa,0,0,0};
#endif
static const struct test_data static const struct test_data
{ {
PixelFormat format; PixelFormat format;
...@@ -3446,7 +3444,6 @@ static void test_bitmapbits(void) ...@@ -3446,7 +3444,6 @@ static void test_bitmapbits(void)
{ PixelFormat8bppIndexed, 8, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_8_77, pixels_24 }, { PixelFormat8bppIndexed, 8, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_8_77, pixels_24 },
{ PixelFormat8bppIndexed, 8, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 }, { PixelFormat8bppIndexed, 8, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 },
{ PixelFormat8bppIndexed, 8, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 }, { PixelFormat8bppIndexed, 8, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 },
#if 0 /* FIXME: these tests crash gdiplus in Wine */
/* 15 */ /* 15 */
{ PixelFormat1bppIndexed, 1, 0, 4, 8, pixels_1, pixels_24 }, { PixelFormat1bppIndexed, 1, 0, 4, 8, pixels_1, pixels_24 },
{ PixelFormat1bppIndexed, 1, ImageLockModeRead, 4, 8, pixels_1, pixels_24 }, { PixelFormat1bppIndexed, 1, ImageLockModeRead, 4, 8, pixels_1, pixels_24 },
...@@ -3455,7 +3452,6 @@ static void test_bitmapbits(void) ...@@ -3455,7 +3452,6 @@ static void test_bitmapbits(void)
{ PixelFormat1bppIndexed, 1, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_1_77, pixels_24 }, { PixelFormat1bppIndexed, 1, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_1_77, pixels_24 },
{ PixelFormat1bppIndexed, 1, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 }, { PixelFormat1bppIndexed, 1, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 },
{ PixelFormat1bppIndexed, 1, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 }, { PixelFormat1bppIndexed, 1, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 },
#endif
}; };
BYTE buf[64]; BYTE buf[64];
GpStatus status; GpStatus status;
......
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