mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
94 lines
3.6 KiB
Diff
94 lines
3.6 KiB
Diff
From e72c3ef9b52c3b5b099907c017206f168cff419f Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
|
Date: Wed, 5 Apr 2017 12:03:19 +0800
|
|
Subject: [PATCH] oleaut32: Make OleLoadPicture load DIBs using WIC decoder.
|
|
|
|
CreateDIBSection doesn't support RLE compressed bitmaps.
|
|
|
|
This patch fixes a regression with displaying images in a Wix based
|
|
installer.
|
|
---
|
|
dlls/oleaut32/olepicture.c | 21 +--------------------
|
|
dlls/oleaut32/tests/olepicture.c | 12 +++++++++++-
|
|
2 files changed, 12 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
|
|
index 22a34d6e380..37c3983ed21 100644
|
|
--- a/dlls/oleaut32/olepicture.c
|
|
+++ b/dlls/oleaut32/olepicture.c
|
|
@@ -979,25 +979,6 @@ static HRESULT WINAPI OLEPictureImpl_IsDirty(
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
-static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xread)
|
|
-{
|
|
- BITMAPFILEHEADER *bfh = (BITMAPFILEHEADER*)xbuf;
|
|
- BITMAPINFO *bi = (BITMAPINFO*)(bfh+1);
|
|
- void *bits;
|
|
- BITMAP bmp;
|
|
-
|
|
- This->desc.bmp.hbitmap = CreateDIBSection(0, bi, DIB_RGB_COLORS, &bits, NULL, 0);
|
|
- if (This->desc.bmp.hbitmap == 0)
|
|
- return E_FAIL;
|
|
-
|
|
- GetObjectA(This->desc.u.bmp.hbitmap, sizeof(bmp), &bmp);
|
|
- memcpy(bits, xbuf + bfh->bfOffBits, bmp.bmHeight * bmp.bmWidthBytes);
|
|
-
|
|
- This->desc.picType = PICTYPE_BITMAP;
|
|
- OLEPictureImpl_SetBitmap(This);
|
|
- return S_OK;
|
|
-}
|
|
-
|
|
static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSource *src)
|
|
{
|
|
HRESULT hr;
|
|
@@ -1478,7 +1459,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm)
|
|
hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICJpegDecoder, xbuf, xread);
|
|
break;
|
|
case BITMAP_FORMAT_BMP: /* Bitmap */
|
|
- hr = OLEPictureImpl_LoadDIB(This, xbuf, xread);
|
|
+ hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICBmpDecoder, xbuf, xread);
|
|
break;
|
|
case BITMAP_FORMAT_PNG: /* PNG */
|
|
hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICPngDecoder, xbuf, xread);
|
|
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
|
|
index fa7e8009cbd..a1c3ccf20c3 100644
|
|
--- a/dlls/oleaut32/tests/olepicture.c
|
|
+++ b/dlls/oleaut32/tests/olepicture.c
|
|
@@ -97,7 +97,7 @@ static const unsigned char pngimage[285] = {
|
|
0xe7,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
|
};
|
|
|
|
-/* 1x1 pixel bmp */
|
|
+/* 1bpp BI_RGB 1x1 pixel bmp */
|
|
static const unsigned char bmpimage[66] = {
|
|
0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00,
|
|
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
|
|
@@ -106,6 +106,15 @@ static const unsigned char bmpimage[66] = {
|
|
0x00,0x00
|
|
};
|
|
|
|
+/* 8bpp BI_RLE8 1x1 pixel bmp */
|
|
+static const unsigned char bmpimage_rle8[] = {
|
|
+0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00,
|
|
+0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x01,0x00,
|
|
+0x00,0x00,0x04,0x00,0x00,0x00,0x12,0x0b,0x00,0x00,0x12,0x0b,0x00,0x00,0x02,0x00,
|
|
+0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,0x01,
|
|
+0x00,0x00
|
|
+};
|
|
+
|
|
/* 2x2 pixel gif */
|
|
static const unsigned char gif4pixel[42] = {
|
|
0x47,0x49,0x46,0x38,0x37,0x61,0x02,0x00,0x02,0x00,0xa1,0x00,0x00,0x00,0x00,0x00,
|
|
@@ -1492,6 +1501,7 @@ START_TEST(olepicture)
|
|
test_pic(gifimage, sizeof(gifimage));
|
|
test_pic(jpgimage, sizeof(jpgimage));
|
|
test_pic(bmpimage, sizeof(bmpimage));
|
|
+ test_pic(bmpimage_rle8, sizeof(bmpimage_rle8));
|
|
test_pic(gif4pixel, sizeof(gif4pixel));
|
|
/* FIXME: No PNG support in Windows... */
|
|
if (0) test_pic(pngimage, sizeof(pngimage));
|
|
--
|
|
2.40.1
|
|
|