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

Alexandre Julliard julliard at winehq.org
Tue Jul 17 11:05:34 CDT 2012


Module: wine
Branch: master
Commit: d104741a3c7a0893762e2dfe2e67cbbe9c4a3647
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d104741a3c7a0893762e2dfe2e67cbbe9c4a3647

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue Jul 17 15:02:31 2012 +0900

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

---

 dlls/gdiplus/image.c       |   22 ++++++++++++++++++++++
 dlls/gdiplus/tests/image.c |    4 ----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 2e3c164..bfa0156 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -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:
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index da17b5d..7f89aec 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -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;




More information about the wine-cvs mailing list