mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Merge branch '2016-08-use_bgra_colors' of https://github.com/thedmd/imgui into thedmd-2016-08-use_bgra_colors
This commit is contained in:
		
							
								
								
									
										26
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -9544,10 +9548,10 @@ void ImGui::ValueColor(const char* prefix, ImU32 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;
 | 
			
		||||
    col.x = (float)((v >> IM_COL32_R_SHIFT) & 0xFF) / 255.0f;
 | 
			
		||||
    col.y = (float)((v >> IM_COL32_G_SHIFT) & 0xFF) / 255.0f;
 | 
			
		||||
    col.z = (float)((v >> IM_COL32_B_SHIFT) & 0xFF) / 255.0f;
 | 
			
		||||
    col.w = (float)((v >> IM_COL32_A_SHIFT) & 0xFF) / 255.0f;
 | 
			
		||||
    ColorButton(col, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user