From: Matteo Bruni Subject: [PATCH 3/5] d3dx9: Handle GUID_WICPixelFormat8bppGray format. Message-Id: <1415642174-16277-3-git-send-email-mbruni@codeweavers.com> Date: Mon, 10 Nov 2014 18:56:12 +0100 For bug 37074. --- dlls/d3dx9_36/surface.c | 1 + dlls/d3dx9_36/tests/surface.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index c91048b..f187031 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -40,6 +40,7 @@ static const struct { &GUID_WICPixelFormat8bppIndexed, D3DFMT_P8 }, { &GUID_WICPixelFormat1bppIndexed, D3DFMT_P8 }, { &GUID_WICPixelFormat4bppIndexed, D3DFMT_P8 }, + { &GUID_WICPixelFormat8bppGray, D3DFMT_L8 }, { &GUID_WICPixelFormat16bppBGR555, D3DFMT_X1R5G5B5 }, { &GUID_WICPixelFormat16bppBGR565, D3DFMT_R5G6B5 }, { &GUID_WICPixelFormat24bppBGR, D3DFMT_R8G8B8 }, diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index 2ddc704..4490dc3 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -80,6 +80,16 @@ static const unsigned char bmp_8bpp[] = { 0x00,0x00 }; +static const unsigned char png_grayscale[] = +{ + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, + 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x3a, 0x7e, 0x9b, 0x55, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, + 0x41, 0x54, 0x08, 0xd7, 0x63, 0xf8, 0x0f, 0x00, 0x01, 0x01, 0x01, 0x00, 0x1b, + 0xb6, 0xee, 0x56, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82 +}; + /* 2x2 A8R8G8B8 pixel data */ static const unsigned char pixdata[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff @@ -493,6 +503,12 @@ static void test_D3DXGetImageInfo(void) ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth); ok(info.Format == D3DFMT_P8, "Got format %u, expected %u\n", info.Format, D3DFMT_P8); + /* Grayscale PNG */ + hr = D3DXGetImageInfoFromFileInMemory(png_grayscale, sizeof(png_grayscale), &info); + ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); + ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth); + ok(info.Format == D3DFMT_L8, "Got format %u, expected %u\n", info.Format, D3DFMT_L8); + /* test DDS support */ hr = D3DXGetImageInfoFromFileInMemory(dds_24bit, sizeof(dds_24bit), &info); ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); -- 2.0.4