@ -1195,16 +1195,20 @@ int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_e
ImVec4 ImGui : : ColorConvertU32ToFloat4 ( ImU32 in )
{
float s = 1.0f / 255.0f ;
return ImVec4 ( ( in & 0xFF ) * s , ( ( in > > 8 ) & 0xFF ) * s , ( ( in > > 16 ) & 0xFF ) * s , ( in > > 24 ) * s ) ;
return ImVec4 (
( ( in > > IM_COL32_R_SHIFT ) & 0xFF ) * s ,
( ( in > > IM_COL32_G_SHIFT ) & 0xFF ) * s ,
( ( in > > IM_COL32_B_SHIFT ) & 0xFF ) * s ,
( ( in > > IM_COL32_A_SHIFT ) & 0xFF ) * s ) ;
}
ImU32 ImGui : : ColorConvertFloat4ToU32 ( const ImVec4 & in )
{
ImU32 out ;
out = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . x ) ) ;
out | = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . y ) ) < < 8 ;
out | = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . z ) ) < < 16 ;
out | = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . w ) ) < < 24 ;
out = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . x ) ) < < IM_COL32_R_SHIFT ;
out | = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . y ) ) < < IM_COL32_G_SHIFT ;
out | = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . z ) ) < < IM_COL32_B_SHIFT ;
out | = ( ( ImU32 ) IM_F32_TO_INT8_SAT ( in . w ) ) < < IM_COL32_A_SHIFT ;
return out ;
}
@ -1212,14 +1216,14 @@ ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul)
{
ImVec4 c = GImGui - > Style . Colors [ idx ] ;
c . w * = GImGui - > Style . Alpha * alpha_mul ;
return ImGui : : ColorConvertFloat4ToU32( c ) ;
return ColorConvertFloat4ToU32( c ) ;
}
ImU32 ImGui : : GetColorU32 ( const ImVec4 & col )
{
ImVec4 c = col ;
c . w * = GImGui - > Style . Alpha ;
return ImGui : : ColorConvertFloat4ToU32( c ) ;
return ColorConvertFloat4ToU32( c ) ;
}
// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592
@ -8845,7 +8849,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
tb . y = ta . y + ImMax ( ( tb . y - extra ) - ta . y , - 100.0f ) ; // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?
tc . y = ta . y + ImMin ( ( tc . y + extra ) - ta . y , + 100.0f ) ;
moving_within_opened_triangle = ImIsPointInTriangle ( g . IO . MousePos , ta , tb , tc ) ;
//window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? 0x80008000 : 0x80000080 ); window->DrawList->PopClipRect(); // Debug
//window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128) ); window->DrawList->PopClipRect(); // Debug
}
}
@ -9204,7 +9208,7 @@ void ImGui::EndGroup()
window - > DC . GroupStack . pop_back ( ) ;
//window->DrawList->AddRect(group_bb.Min, group_bb.Max, 0xFFFF00FF ); // Debug
//window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255) ); // Debug
}
// Gets back to previous line and continue with horizontal layout
@ -9542,13 +9546,7 @@ void ImGui::ValueColor(const char* prefix, ImU32 v)
{
Text ( " %s: %08X " , prefix , v ) ;
SameLine ( ) ;
ImVec4 col ;
col . x = ( float ) ( ( v > > 0 ) & 0xFF ) / 255.0f ;
col . y = ( float ) ( ( v > > 8 ) & 0xFF ) / 255.0f ;
col . z = ( float ) ( ( v > > 16 ) & 0xFF ) / 255.0f ;
col . w = ( float ) ( ( v > > 24 ) & 0xFF ) / 255.0f ;
ColorButton ( col , true ) ;
ColorButton ( ColorConvertU32ToFloat4 ( v ) , true ) ;
}
//-----------------------------------------------------------------------------