Improve icon cache performance
This commit is contained in:
+24
-10
@@ -3070,8 +3070,8 @@ VOID PhProcessImageListInitialization(
|
||||
|
||||
PhImageListItemType = PhCreateObjectType(L"ImageListItem", 0, PhpImageListItemDeleteProcedure);
|
||||
|
||||
PhProcessLargeImageList = ImageList_Create(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), ILC_MASK | ILC_COLOR32, 100, 100);
|
||||
PhProcessSmallImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 100, 100);
|
||||
PhProcessLargeImageList = ImageList_Create(PhLargeIconSize.X, PhLargeIconSize.Y, ILC_MASK | ILC_COLOR32, 100, 100);
|
||||
PhProcessSmallImageList = ImageList_Create(PhSmallIconSize.X, PhSmallIconSize.Y, ILC_MASK | ILC_COLOR32, 100, 100);
|
||||
ImageList_SetBkColor(PhProcessLargeImageList, CLR_NONE);
|
||||
ImageList_SetBkColor(PhProcessSmallImageList, CLR_NONE);
|
||||
|
||||
@@ -3114,8 +3114,8 @@ PPH_IMAGELIST_ITEM PhImageListExtractIcon(
|
||||
_In_ BOOLEAN NativeFileName
|
||||
)
|
||||
{
|
||||
HICON largeIcon;
|
||||
HICON smallIcon;
|
||||
HICON largeIcon = NULL;
|
||||
HICON smallIcon = NULL;
|
||||
PPH_IMAGELIST_ITEM newentry;
|
||||
|
||||
PhAcquireQueuedLockShared(&PhImageListCacheHashtableLock);
|
||||
@@ -3144,8 +3144,13 @@ PPH_IMAGELIST_ITEM PhImageListExtractIcon(
|
||||
|
||||
PhReleaseQueuedLockShared(&PhImageListCacheHashtableLock);
|
||||
|
||||
if (!PhExtractIconEx(FileName, NativeFileName, 0, &largeIcon, &smallIcon))
|
||||
return NULL;
|
||||
PhExtractIconEx(
|
||||
FileName,
|
||||
NativeFileName,
|
||||
0,
|
||||
&largeIcon,
|
||||
&smallIcon
|
||||
);
|
||||
|
||||
PhAcquireQueuedLockExclusive(&PhImageListCacheHashtableLock);
|
||||
|
||||
@@ -3161,10 +3166,19 @@ PPH_IMAGELIST_ITEM PhImageListExtractIcon(
|
||||
|
||||
newentry = PhCreateObjectZero(sizeof(PH_IMAGELIST_ITEM), PhImageListItemType);
|
||||
newentry->FileName = PhReferenceObject(FileName);
|
||||
newentry->LargeIconIndex = ImageList_AddIcon(PhProcessLargeImageList, largeIcon);
|
||||
newentry->SmallIconIndex = ImageList_AddIcon(PhProcessSmallImageList, smallIcon);
|
||||
DestroyIcon(smallIcon);
|
||||
DestroyIcon(largeIcon);
|
||||
|
||||
if (largeIcon && smallIcon)
|
||||
{
|
||||
newentry->LargeIconIndex = ImageList_AddIcon(PhProcessLargeImageList, largeIcon);
|
||||
newentry->SmallIconIndex = ImageList_AddIcon(PhProcessSmallImageList, smallIcon);
|
||||
DestroyIcon(smallIcon);
|
||||
DestroyIcon(largeIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
newentry->LargeIconIndex = 0;
|
||||
newentry->SmallIconIndex = 0;
|
||||
}
|
||||
|
||||
PhReferenceObject(newentry);
|
||||
PhAddEntryHashtable(PhImageListCacheHashtable, &newentry);
|
||||
|
||||
@@ -120,8 +120,8 @@ VOID PhpSearchInitializeImages(
|
||||
{
|
||||
HBITMAP bitmap;
|
||||
|
||||
Context->ImageWidth = GetSystemMetrics(SM_CXSMICON) + 4;
|
||||
Context->ImageHeight = GetSystemMetrics(SM_CYSMICON) + 4;
|
||||
Context->ImageWidth = PhSmallIconSize.X + 4; //GetSystemMetrics(SM_CXSMICON) + 4;
|
||||
Context->ImageHeight = PhSmallIconSize.Y + 4; //GetSystemMetrics(SM_CYSMICON) + 4;
|
||||
Context->ImageListHandle = ImageList_Create(
|
||||
Context->ImageWidth,
|
||||
Context->ImageHeight,
|
||||
|
||||
+2
-2
@@ -78,8 +78,8 @@ BOOLEAN PhTreeNewInitialization(
|
||||
return FALSE;
|
||||
|
||||
ComCtl32Handle = PhGetLoaderEntryDllBase(L"comctl32.dll");
|
||||
SmallIconWidth = GetSystemMetrics(SM_CXSMICON);
|
||||
SmallIconHeight = GetSystemMetrics(SM_CYSMICON);
|
||||
SmallIconWidth = PhSmallIconSize.X; //GetSystemMetrics(SM_CXSMICON);
|
||||
SmallIconHeight = PhSmallIconSize.Y; //GetSystemMetrics(SM_CYSMICON);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -293,8 +293,8 @@ VOID PhpSearchInitializeImages(
|
||||
{
|
||||
HBITMAP bitmap;
|
||||
|
||||
Context->ImageWidth = GetSystemMetrics(SM_CXSMICON) + 4;
|
||||
Context->ImageHeight = GetSystemMetrics(SM_CYSMICON) + 4;
|
||||
Context->ImageWidth = PhSmallIconSize.X + 4; //GetSystemMetrics(SM_CXSMICON) + 4;
|
||||
Context->ImageHeight = PhSmallIconSize.Y + 4; //GetSystemMetrics(SM_CYSMICON) + 4;
|
||||
|
||||
if (bitmap = PhLoadPngImageFromResource(PhInstanceHandle, Context->ImageWidth, Context->ImageHeight, MAKEINTRESOURCE(IDB_SEARCH_ACTIVE), TRUE))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user