mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added oleaut32-default-pic-size patchset
This commit is contained in:
parent
d3d87f1a2c
commit
453c5cda07
@ -0,0 +1,82 @@
|
||||
From e6f8042ee351aa6821639a1d99e003e8425c36e9 Mon Sep 17 00:00:00 2001
|
||||
From: Damjan Jovanovic <damjan.jov@gmail.com>
|
||||
Date: Sat, 29 Feb 2020 09:21:55 +0200
|
||||
Subject: [PATCH] oleaut32: preferentially load icons having the desired size
|
||||
in OleLoadPictureEx
|
||||
|
||||
Currently OleLoadPictureEx() ignores the caller-desired icon size
|
||||
and always loads the 32x32 icon, which sometimes has to be
|
||||
scaled down to 16x16, resulting in quality loss. Change this
|
||||
to load the icon having the desired size, falling back to 32x32
|
||||
only when the desired size is unavailable.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=20732
|
||||
|
||||
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
|
||||
|
||||
Updated to default 32 when x/y are LP_DEFAULT.
|
||||
---
|
||||
dlls/oleaut32/olepicture.c | 22 ++++++++++++++++++----
|
||||
1 file changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
|
||||
index 535a16146aa..05ad1137296 100644
|
||||
--- a/dlls/oleaut32/olepicture.c
|
||||
+++ b/dlls/oleaut32/olepicture.c
|
||||
@@ -151,6 +151,8 @@ typedef struct OLEPictureImpl {
|
||||
BOOL bIsDirty; /* Set to TRUE if picture has changed */
|
||||
unsigned int loadtime_magic; /* If a length header was found, saves value */
|
||||
unsigned int loadtime_format; /* for PICTYPE_BITMAP only, keeps track of image format (GIF/BMP/JPEG) */
|
||||
+ DWORD desiredWidth;
|
||||
+ DWORD desiredHeight;
|
||||
} OLEPictureImpl;
|
||||
|
||||
static inline OLEPictureImpl *impl_from_IPicture(IPicture *iface)
|
||||
@@ -1190,14 +1192,20 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x
|
||||
return E_FAIL;
|
||||
}
|
||||
i=0;
|
||||
- /* If we have more than one icon, try to find the best.
|
||||
- * this currently means '32 pixel wide'.
|
||||
- */
|
||||
if (cifd->idCount!=1) {
|
||||
+ /* First try exact match on the desired dimensions */
|
||||
for (i=0;i<cifd->idCount;i++) {
|
||||
- if (cifd->idEntries[i].bWidth == 32)
|
||||
+ if (cifd->idEntries[i].bWidth == This->desiredWidth &&
|
||||
+ cifd->idEntries[i].bHeight == This->desiredHeight)
|
||||
break;
|
||||
}
|
||||
+ /* Otherwise, try to find the best. This currently means '32 pixel wide'. */
|
||||
+ if (i==cifd->idCount) {
|
||||
+ for (i=0;i<cifd->idCount;i++) {
|
||||
+ if (cifd->idEntries[i].bWidth == 32)
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
if (i==cifd->idCount) i=0;
|
||||
}
|
||||
if (xread < cifd->idEntries[i].dwDIBOffset + cifd->idEntries[i].dwDIBSize)
|
||||
@@ -2356,6 +2364,7 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
||||
{
|
||||
LPPERSISTSTREAM ps;
|
||||
IPicture *newpic;
|
||||
+ OLEPictureImpl *pictureImpl;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("%p, %ld, %d, %s, %lu, %lu, %#lx, %p, partially implemented.\n",
|
||||
@@ -2364,6 +2373,11 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
||||
hr = OleCreatePictureIndirect(NULL,riid,!fRunmode,(LPVOID*)&newpic);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
+ if (xsiz == LP_DEFAULT && ysiz == LP_DEFAULT)
|
||||
+ xsiz = ysiz = 32;
|
||||
+ pictureImpl = impl_from_IPicture(newpic);
|
||||
+ pictureImpl->desiredWidth = xsiz;
|
||||
+ pictureImpl->desiredHeight = ysiz;
|
||||
hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps);
|
||||
if (hr != S_OK) {
|
||||
ERR("Could not get IPersistStream iface from Ole Picture?\n");
|
||||
--
|
||||
2.40.1
|
||||
|
1
patches/oleaut32-default-pic-size/definition
Normal file
1
patches/oleaut32-default-pic-size/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [20732] OleLoadPictureEx - First look for specific size if specified.
|
Loading…
Reference in New Issue
Block a user