Skip to content

Commit

Permalink
added Crinkler heat map color scheme support
Browse files Browse the repository at this point in the history
  • Loading branch information
BoyC committed Apr 10, 2024
1 parent 9ee83e1 commit b9f8a58
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ void CreateRenderTarget();
void CleanupRenderTarget();
LRESULT WINAPI WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );

bool darkColors = true;

// crinkler color scheme
/*
ImU32 heatMap[]
{
0x80ffffff, // 0.0
Expand All @@ -36,7 +37,7 @@ ImU32 heatMap[]
0xffff0000, // 1000000.0
};

ImU32 GetRatioColor(double ratio)
ImU32 GetCrinklerRatioColor(double ratio)
{
if (ratio == 0 || isinf(ratio) || isnan(ratio))
return 0xff808080;
Expand Down Expand Up @@ -64,7 +65,6 @@ ImU32 GetRatioColor(double ratio)
return heatMap[10];
return heatMap[10];
}
*/

ImU32 GetCompressionColorGradient( int t )
{
Expand Down Expand Up @@ -101,6 +101,9 @@ ImU32 GetCompressionColorGradient( int t )

ImU32 GetRatioColor( double ratio )
{
if ( !darkColors )
return GetCrinklerRatioColor( ratio );

if ( ratio == 0 || isinf( ratio ) || isnan( ratio ) )
return 0xff808080;

Expand Down Expand Up @@ -990,6 +993,16 @@ INT WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
}
if ( ImGui::MenuItem( "Open sym file", nullptr, nullptr, true ) )
OpenSYM();

if ( ImGui::MenuItem( "Toggle color scheme", nullptr, nullptr, true ) )
{
darkColors = !darkColors;
if ( darkColors )
ImGui::StyleColorsDark();
else
ImGui::StyleColorsLight();
}

ImGui::EndMenu();
}

Expand Down

0 comments on commit b9f8a58

Please sign in to comment.