Rebase against 16e73be10d940c9c04101a47687a6f8a385c2b0f.

This commit is contained in:
Zebediah Figura
2021-09-17 17:45:25 -05:00
parent 3a06c15dd2
commit fdcc8bec48
9 changed files with 105 additions and 105 deletions

View File

@ -1,4 +1,4 @@
From e42e76b1a48a1a523f8405c85a2baf9df9e4dabb Mon Sep 17 00:00:00 2001
From 6b66550b43ca3a870b6d8a8eb2aaef7001d8abc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= <gabrielopcode@gmail.com>
Date: Fri, 30 Nov 2018 12:20:40 +0200
Subject: [PATCH] shell32/iconcache: Generate icons from available icons if
@ -19,14 +19,22 @@ smaller icons are only picked if no other available icon is larger).
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45696
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
---
dlls/shell32/iconcache.c | 67 +++++++++++++++++++++++++++++++++-------
1 file changed, 56 insertions(+), 11 deletions(-)
dlls/shell32/iconcache.c | 68 +++++++++++++++++++++++++++++++++-------
1 file changed, 57 insertions(+), 11 deletions(-)
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index 44422ab..5ffb293 100644
index f1d95e851eb..9d5f8b1c04a 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -345,13 +345,6 @@ static INT SIC_IconAppend (const WCHAR *sourcefile, INT src_index, HICON *hicons
@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
+#include <math.h>
#define COBJMACROS
@@ -339,13 +340,6 @@ static INT SIC_IconAppend (const WCHAR *sourcefile, INT src_index, HICON *hicons
return ret;
}
@ -40,7 +48,7 @@ index 44422ab..5ffb293 100644
/****************************************************************************
* SIC_LoadIcon [internal]
*
@@ -362,15 +355,67 @@ static INT SIC_LoadIcon (const WCHAR *sourcefile, INT index, DWORD flags)
@@ -356,15 +350,67 @@ static INT SIC_LoadIcon (const WCHAR *sourcefile, INT index, DWORD flags)
{
HICON hicons[ARRAY_SIZE(shell_imagelists)] = { 0 };
HICON hshortcuts[ARRAY_SIZE(hicons)] = { 0 };
@ -50,8 +58,11 @@ index 44422ab..5ffb293 100644
INT ret = -1;
+ /* Keep track of the sizes in case any icon fails to get extracted */
+ for (i = 0; i < ARRAY_SIZE(hicons); i++)
+ {
for (i = 0; i < ARRAY_SIZE(hicons); i++)
{
- get_imagelist_icon_size( i, &size );
- if (!PrivateExtractIconsW( sourcefile, index, size.cx, size.cy, &hicons[i], 0, 1, 0 ))
- WARN("Failed to load icon %d from %s.\n", index, debugstr_w(sourcefile));
+ ImageList_GetIconSize(shell_imagelists[i], &size[i].cx, &size[i].cy);
+ PrivateExtractIconsW(sourcefile, index, size[i].cx, size[i].cy, &hicons[i], 0, 1, 0);
+ }
@ -59,11 +70,8 @@ index 44422ab..5ffb293 100644
+ /* Fill any icon handles that failed to get extracted, by resizing
+ another icon handle that succeeded and creating the icon from it.
+ Use a dumb O(n^2) algorithm since ARRAY_SIZE(hicons) is small */
for (i = 0; i < ARRAY_SIZE(hicons); i++)
{
- get_imagelist_icon_size( i, &size );
- if (!PrivateExtractIconsW( sourcefile, index, size.cx, size.cy, &hicons[i], 0, 1, 0 ))
- WARN("Failed to load icon %d from %s.\n", index, debugstr_w(sourcefile));
+ for (i = 0; i < ARRAY_SIZE(hicons); i++)
+ {
+ unsigned int k, ix, iy;
+ BOOL failed = TRUE;
+ if (hicons[i]) continue;
@ -113,5 +121,5 @@ index 44422ab..5ffb293 100644
}
--
2.19.1
2.33.0