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

This commit is contained in:
Dmitry Timoshkov 2012-07-17 15:02:31 +09:00 committed by Alexandre Julliard
parent 2ed1aaa930
commit d104741a3c
2 changed files with 22 additions and 4 deletions

View File

@ -637,6 +637,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppGrayScale:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppGrayScale, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppGrayScale, setpixel_8bppIndexed);
case PixelFormat16bppRGB555:
@ -664,6 +666,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppRGB555:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB555, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB555, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -691,6 +695,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppRGB565:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB565, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppRGB565, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -718,6 +724,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat16bppARGB1555:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_16bppARGB1555, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_16bppARGB1555, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -745,6 +753,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat24bppRGB:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_24bppRGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_24bppRGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -772,6 +782,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat32bppRGB:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_32bppRGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_32bppRGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -799,6 +811,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat32bppARGB:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_32bppARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_32bppARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -825,6 +839,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat32bppPARGB:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_32bppPARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_32bppPARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -852,6 +868,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat48bppRGB:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_48bppRGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_48bppRGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -879,6 +897,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat64bppARGB:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_64bppARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_64bppARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:
@ -906,6 +926,8 @@ GpStatus convert_pixels(INT width, INT height,
case PixelFormat64bppPARGB:
switch (dst_format)
{
case PixelFormat1bppIndexed:
convert_rgb_to_indexed(getpixel_64bppPARGB, setpixel_1bppIndexed);
case PixelFormat8bppIndexed:
convert_rgb_to_indexed(getpixel_64bppPARGB, setpixel_8bppIndexed);
case PixelFormat16bppGrayScale:

View File

@ -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
};
#if 0 /* FIXME: these tests crash gdiplus in Wine */
static const BYTE pixels_1_77[64] =
{
0xaa,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
@ -3417,7 +3416,6 @@ static void test_bitmapbits(void)
0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77
};
static const BYTE pixels_1[8] = {0xaa,0,0,0,0xaa,0,0,0};
#endif
static const struct test_data
{
PixelFormat format;
@ -3446,7 +3444,6 @@ static void test_bitmapbits(void)
{ PixelFormat8bppIndexed, 8, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_8_77, pixels_24 },
{ PixelFormat8bppIndexed, 8, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 },
{ PixelFormat8bppIndexed, 8, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 },
#if 0 /* FIXME: these tests crash gdiplus in Wine */
/* 15 */
{ PixelFormat1bppIndexed, 1, 0, 4, 8, pixels_1, pixels_24 },
{ PixelFormat1bppIndexed, 1, ImageLockModeRead, 4, 8, pixels_1, pixels_24 },
@ -3455,7 +3452,6 @@ static void test_bitmapbits(void)
{ PixelFormat1bppIndexed, 1, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_1_77, pixels_24 },
{ PixelFormat1bppIndexed, 1, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 },
{ PixelFormat1bppIndexed, 1, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 },
#endif
};
BYTE buf[64];
GpStatus status;