Module: wine Branch: master Commit: 8c593bd37ad1177144d720d17b6b706d2ee619f1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8c593bd37ad1177144d720d17b...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Mon Aug 28 11:30:16 2017 -0500
gdiplus: Set correct color space flags for grayscale images.
Signed-off-by: Vincent Povirk vincent@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdiplus/image.c | 9 ++++++++- dlls/gdiplus/tests/image.c | 1 - 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index e3bc70e..80ad65f 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -3718,7 +3718,14 @@ static GpStatus decode_frame_wic(IWICBitmapDecoder *decoder, BOOL force_conversi if (status == Ok) { /* Native GDI+ used to be smarter, but since Win7 it just sets these flags. */ - bitmap->image.flags |= ImageFlagsReadOnly|ImageFlagsHasRealPixelSize|ImageFlagsHasRealDPI|ImageFlagsColorSpaceRGB; + bitmap->image.flags |= ImageFlagsReadOnly|ImageFlagsHasRealPixelSize|ImageFlagsHasRealDPI; + if (IsEqualGUID(&wic_format, &GUID_WICPixelFormat2bppGray) || + IsEqualGUID(&wic_format, &GUID_WICPixelFormat4bppGray) || + IsEqualGUID(&wic_format, &GUID_WICPixelFormat8bppGray) || + IsEqualGUID(&wic_format, &GUID_WICPixelFormat16bppGray)) + bitmap->image.flags |= ImageFlagsColorSpaceGRAY; + else + bitmap->image.flags |= ImageFlagsColorSpaceRGB; bitmap->image.frame_count = frame_count; bitmap->image.current_frame = active_frame; bitmap->image.decoder = decoder; diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 9f7cf66..a1bd056 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5022,7 +5022,6 @@ static void test_png_color_formats(void)
status = GdipGetImageFlags(image, &flags); expect(Ok, status); -todo_wine_if(td[i].bit_depth > 1 && td[i].color_type == 0) ok((flags & td[i].flags) == td[i].flags || broken(td[i].bit_depth == 1 && td[i].color_type == 0 && (flags & ImageFlagsColorSpaceGRAY)), /* XP */ "%d: expected %#x, got %#x\n", i, td[i].flags, flags);