From 3971519e4bc22615848ba6f05ee39b13aec3f4c0 Mon Sep 17 00:00:00 2001 From: Dart Vanya Date: Thu, 12 Dec 2024 21:08:42 +0300 Subject: [PATCH] [test] graph old colors - use theme colors for background and grid --- SystemInformer/sysinfo.c | 8 +++---- phlib/include/guisup.h | 33 ++++++++++++++++++++++++++++ plugins/ExtendedTools/objmgr.c | 5 +---- plugins/HardwareDevices/gpuoptions.c | 1 + 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/SystemInformer/sysinfo.c b/SystemInformer/sysinfo.c index 178604cf2804..a85584a0c911 100644 --- a/SystemInformer/sysinfo.c +++ b/SystemInformer/sysinfo.c @@ -1074,15 +1074,15 @@ VOID PhSiSetColorsGraphDrawInfo( DrawInfo->TextBoxColor = RGB(0xe7, 0xe7, 0xe7); break; case 1: // Old colors - DrawInfo->BackColor = RGB(0x00, 0x00, 0x00); + DrawInfo->BackColor = PhThemeWindowForegroundColor; DrawInfo->LineColor1 = Color1; DrawInfo->LineBackColor1 = PhHalveColorBrightness(Color1); DrawInfo->LineColor2 = Color2; DrawInfo->LineBackColor2 = PhHalveColorBrightness(Color2); - DrawInfo->GridColor = RGB(0x00, 0x57, 0x00); + DrawInfo->GridColor = PhThemeWindowBackground2Color; DrawInfo->LabelYColor = RGB(0xd0, 0xa0, 0x70); - DrawInfo->TextColor = RGB(0x00, 0xff, 0x00); - DrawInfo->TextBoxColor = RGB(0x00, 0x22, 0x00); + DrawInfo->TextColor = PhMakeColorDarker(PhThemeWindowTextColor, 7); + DrawInfo->TextBoxColor = PhThemeWindowBackgroundColor; break; } } diff --git a/phlib/include/guisup.h b/phlib/include/guisup.h index 8e09142e06d7..2dfc64138682 100644 --- a/phlib/include/guisup.h +++ b/phlib/include/guisup.h @@ -1722,6 +1722,39 @@ PhMakeColorBrighter( return RGB(r, g, b); } +FORCEINLINE +COLORREF +PhMakeColorDarker( + _In_ COLORREF Color, + _In_ UCHAR Increment + ) +{ + UCHAR r; + UCHAR g; + UCHAR b; + + r = (UCHAR)Color; + g = (UCHAR)(Color >> 8); + b = (UCHAR)(Color >> 16); + + if (r - Increment > 0) + r -= Increment; + else + r = 0; + + if (g - Increment > 0) + g -= Increment; + else + g = 0; + + if (b - Increment > 0) + b -= Increment; + else + b = 0; + + return RGB(r, g, b); +} + // Window support typedef enum _PH_PLUGIN_WINDOW_EVENT_TYPE diff --git a/plugins/ExtendedTools/objmgr.c b/plugins/ExtendedTools/objmgr.c index 850c455948e5..ea8192b0e98f 100644 --- a/plugins/ExtendedTools/objmgr.c +++ b/plugins/ExtendedTools/objmgr.c @@ -1454,10 +1454,7 @@ VOID EtObjectManagerFreeListViewItems( PhClearReference(&Context->CurrentPath); - for (ULONG i = 0; i < Context->CurrentDirectoryList->Count; i++) - { - PhDereferenceObject(Context->CurrentDirectoryList->Items[i]); - } + PhDereferenceObjects(Context->CurrentDirectoryList->Items, Context->CurrentDirectoryList->Count); //INT index = INT_ERROR; //while ((index = PhFindListViewItemByFlags( diff --git a/plugins/HardwareDevices/gpuoptions.c b/plugins/HardwareDevices/gpuoptions.c index f3e3d7dedf05..f473b132efd7 100644 --- a/plugins/HardwareDevices/gpuoptions.c +++ b/plugins/HardwareDevices/gpuoptions.c @@ -499,6 +499,7 @@ VOID FindGraphicsDevices( PhFree(entry); } PhReleaseQueuedLockShared(&GraphicsDevicesListLock); + PhDereferenceObject(deviceList); // HACK: Show all unknown devices. PhAcquireQueuedLockShared(&GraphicsDevicesListLock);