mirror of
https://github.com/ocornut/imgui.git
synced 2026-07-31 12:49:15 +00:00
Tweaks.
This commit is contained in:
@@ -148,7 +148,7 @@ static void ImGui_ImplDX10_SetupRenderState(ImDrawData* draw_data, ID3D10Device*
|
||||
device->GSSetShader(nullptr);
|
||||
|
||||
// Setup render state
|
||||
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
|
||||
const float blend_factor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
device->OMSetBlendState(bd->pBlendState, blend_factor, 0xffffffff);
|
||||
device->OMSetDepthStencilState(bd->pDepthStencilState, 0);
|
||||
device->RSSetState(bd->pRasterizerState);
|
||||
@@ -446,7 +446,7 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
|
||||
PS_INPUT main(VS_INPUT input)\
|
||||
{\
|
||||
PS_INPUT output;\
|
||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.0f, 1.0f));\
|
||||
output.col = input.col;\
|
||||
output.uv = input.uv;\
|
||||
return output;\
|
||||
@@ -566,10 +566,10 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
|
||||
desc.AddressU = D3D10_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.AddressV = D3D10_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.MipLODBias = 0.f;
|
||||
desc.MipLODBias = 0.0f;
|
||||
desc.ComparisonFunc = D3D10_COMPARISON_ALWAYS;
|
||||
desc.MinLOD = 0.f;
|
||||
desc.MaxLOD = 0.f;
|
||||
desc.MinLOD = 0.0f;
|
||||
desc.MaxLOD = 0.0f;
|
||||
bd->pd3dDevice->CreateSamplerState(&desc, &bd->pTexSamplerLinear);
|
||||
desc.Filter = D3D10_FILTER_MIN_MAG_MIP_POINT;
|
||||
bd->pd3dDevice->CreateSamplerState(&desc, &bd->pTexSamplerNearest);
|
||||
|
||||
@@ -155,7 +155,7 @@ static void ImGui_ImplDX11_SetupRenderState(const ImDrawData* draw_data, ID3D11D
|
||||
device_ctx->CSSetShader(nullptr, nullptr, 0); // In theory we should backup and restore this as well.. very infrequently used..
|
||||
|
||||
// Setup render state
|
||||
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
|
||||
const float blend_factor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
device_ctx->OMSetBlendState(bd->pBlendState, blend_factor, 0xffffffff);
|
||||
device_ctx->OMSetDepthStencilState(bd->pDepthStencilState, 0);
|
||||
device_ctx->RSSetState(bd->pRasterizerState);
|
||||
@@ -462,7 +462,7 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
|
||||
PS_INPUT main(VS_INPUT input)\
|
||||
{\
|
||||
PS_INPUT output;\
|
||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.0f, 1.0f));\
|
||||
output.col = input.col;\
|
||||
output.uv = input.uv;\
|
||||
return output;\
|
||||
@@ -581,10 +581,10 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
|
||||
desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.MipLODBias = 0.f;
|
||||
desc.MipLODBias = 0.0f;
|
||||
desc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
|
||||
desc.MinLOD = 0.f;
|
||||
desc.MaxLOD = 0.f;
|
||||
desc.MinLOD = 0.0f;
|
||||
desc.MaxLOD = 0.0f;
|
||||
bd->pd3dDevice->CreateSamplerState(&desc, &bd->pTexSamplerLinear);
|
||||
desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||
bd->pd3dDevice->CreateSamplerState(&desc, &bd->pTexSamplerNearest);
|
||||
|
||||
@@ -207,7 +207,7 @@ static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12Graphic
|
||||
command_list->SetGraphicsRoot32BitConstants(0, 16, &vertex_constant_buffer, 0);
|
||||
|
||||
// Setup blend factor
|
||||
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
|
||||
const float blend_factor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
command_list->OMSetBlendFactor(blend_factor);
|
||||
}
|
||||
|
||||
@@ -614,11 +614,11 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
|
||||
staticSampler[0].AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
||||
staticSampler[0].AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
||||
staticSampler[0].AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
||||
staticSampler[0].MipLODBias = 0.f;
|
||||
staticSampler[0].MipLODBias = 0.0f;
|
||||
staticSampler[0].MaxAnisotropy = 0;
|
||||
staticSampler[0].ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
|
||||
staticSampler[0].BorderColor = D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK;
|
||||
staticSampler[0].MinLOD = 0.f;
|
||||
staticSampler[0].MinLOD = 0.0f;
|
||||
staticSampler[0].MaxLOD = D3D12_FLOAT32_MAX;
|
||||
staticSampler[0].ShaderRegister = 0;
|
||||
staticSampler[0].RegisterSpace = 0;
|
||||
@@ -721,7 +721,7 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
|
||||
PS_INPUT main(VS_INPUT input)\
|
||||
{\
|
||||
PS_INPUT output;\
|
||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.0f, 1.0f));\
|
||||
output.col = input.col;\
|
||||
output.uv = input.uv;\
|
||||
return output;\
|
||||
|
||||
@@ -449,7 +449,7 @@ static void ImGui_ImplWGPU_SetupRenderState(ImDrawData* draw_data, WGPURenderPas
|
||||
wgpuRenderPassEncoderSetBindGroup(ctx, 0, bd->renderResources.CommonBindGroupLinear, 0, nullptr);
|
||||
|
||||
// Setup blend factor
|
||||
WGPUColor blend_color = { 0.f, 0.f, 0.f, 0.f };
|
||||
WGPUColor blend_color = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
wgpuRenderPassEncoderSetBlendConstant(ctx, &blend_color);
|
||||
}
|
||||
|
||||
|
||||
18
imgui.cpp
18
imgui.cpp
@@ -2860,7 +2860,7 @@ IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||
|
||||
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b)
|
||||
{
|
||||
float t = ((col_b >> IM_COL32_A_SHIFT) & 0xFF) / 255.f;
|
||||
float t = ((col_b >> IM_COL32_A_SHIFT) & 0xFF) / 255.0f;
|
||||
int r = ImLerp((int)(col_a >> IM_COL32_R_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_R_SHIFT) & 0xFF, t);
|
||||
int g = ImLerp((int)(col_a >> IM_COL32_G_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_G_SHIFT) & 0xFF, t);
|
||||
int b = ImLerp((int)(col_a >> IM_COL32_B_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_B_SHIFT) & 0xFF, t);
|
||||
@@ -2891,20 +2891,20 @@ ImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in)
|
||||
// Optimized http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
|
||||
void ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v)
|
||||
{
|
||||
float K = 0.f;
|
||||
float K = 0.0f;
|
||||
if (g < b)
|
||||
{
|
||||
ImSwap(g, b);
|
||||
K = -1.f;
|
||||
K = -1.0f;
|
||||
}
|
||||
if (r < g)
|
||||
{
|
||||
ImSwap(r, g);
|
||||
K = -2.f / 6.f - K;
|
||||
K = -2.0f / 6.0f - K;
|
||||
}
|
||||
|
||||
const float chroma = r - (g < b ? g : b);
|
||||
out_h = ImFabs(K + (g - b) / (6.f * chroma + 1e-20f));
|
||||
out_h = ImFabs(K + (g - b) / (6.0f * chroma + 1e-20f));
|
||||
out_s = chroma / (r + 1e-20f);
|
||||
out_v = r;
|
||||
}
|
||||
@@ -7746,10 +7746,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
if (flags & ImGuiWindowFlags_AlwaysAutoResize)
|
||||
{
|
||||
if (!window_size_x_set_by_api)
|
||||
window->Size.x = window->SizeFull.x = 0.f;
|
||||
window->Size.x = window->SizeFull.x = 0.0f;
|
||||
if (!window_size_y_set_by_api)
|
||||
window->Size.y = window->SizeFull.y = 0.f;
|
||||
window->ContentSize = window->ContentSizeIdeal = ImVec2(0.f, 0.f);
|
||||
window->Size.y = window->SizeFull.y = 0.0f;
|
||||
window->ContentSize = window->ContentSizeIdeal = ImVec2(0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18519,7 +18519,7 @@ void ImGui::ShowIDStackToolWindow(bool* p_open)
|
||||
Checkbox("Ctrl+C: copy path", &tool->OptCopyToClipboardOnCtrlC);
|
||||
PopStyleVar();
|
||||
SameLine();
|
||||
TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*");
|
||||
TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.0f, 1.0f, 0.3f, 1.0f) : ImVec4(), "*COPIED*");
|
||||
if (tool->OptCopyToClipboardOnCtrlC && Shortcut(ImGuiMod_Ctrl | ImGuiKey_C, ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteOverFocused))
|
||||
{
|
||||
tool->CopyToClipboardLastTime = (float)g.Time;
|
||||
|
||||
2
imgui.h
2
imgui.h
@@ -3298,7 +3298,7 @@ enum ImDrawFlags_
|
||||
|
||||
// Stroke options
|
||||
ImDrawFlags_Closed = 1 << 9, // PathStroke(), AddPolyline(): specify that shape should be closed.
|
||||
//ImDrawFlags_Closed = 1 << 0, // Prior to 1.92.8 (May 2026), ImDrawFlags_Closed was guaranteed to be == 1<<0 == 1 for legacy compatibility reason. Hardcoded use of 1 or true should be replaced.
|
||||
//ImDrawFlags_Closed = 1, // Prior to 1.92.8 (May 2026), ImDrawFlags_Closed was guaranteed to be == 1<<0 == 1 for legacy compatibility reason. Hardcoded use of 1 or true should be replaced.
|
||||
|
||||
ImDrawFlags_InvalidMask_ = ~0x7FFFFFF0, // == 0x8000000F,
|
||||
};
|
||||
|
||||
@@ -1747,7 +1747,7 @@ static void DemoWindowWidgetsDragAndDrop()
|
||||
|
||||
if (ImGui::IsItemActive() && !ImGui::IsItemHovered())
|
||||
{
|
||||
int n_next = n + (ImGui::GetMouseDragDelta(0).y < 0.f ? -1 : 1);
|
||||
int n_next = n + (ImGui::GetMouseDragDelta(0).y < 0.0f ? -1 : 1);
|
||||
if (n_next >= 0 && n_next < IM_COUNTOF(item_names))
|
||||
{
|
||||
item_names[n] = item_names[n_next];
|
||||
@@ -2201,7 +2201,7 @@ static void DemoWindowWidgetsProgressBars()
|
||||
|
||||
char buf[32];
|
||||
sprintf(buf, "%d/%d", (int)(progress * 1753), 1753);
|
||||
ImGui::ProgressBar(progress, ImVec2(0.f, 0.f), buf);
|
||||
ImGui::ProgressBar(progress, ImVec2(0.0f, 0.0f), buf);
|
||||
|
||||
// Pass an animated negative value, e.g. -1.0f * (float)ImGui::GetTime() is the recommended value.
|
||||
// Adjust the factor if you want to adjust the animation speed.
|
||||
@@ -9094,7 +9094,7 @@ struct ExampleAppConsole
|
||||
static int Stricmp(const char* s1, const char* s2) { int d; while ((d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; } return d; }
|
||||
static int Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; n--; } return d; }
|
||||
static char* Strdup(const char* s) { IM_ASSERT(s); size_t len = strlen(s) + 1; void* buf = ImGui::MemAlloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)s, len); }
|
||||
static void Strtrim(char* s) { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; }
|
||||
static void Strtrimblanks(char* s) { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; }
|
||||
|
||||
void ClearLog()
|
||||
{
|
||||
@@ -9243,10 +9243,10 @@ struct ExampleAppConsole
|
||||
if (ImGui::InputText("Input", InputBuf, IM_COUNTOF(InputBuf), input_text_flags, &TextEditCallbackStub, (void*)this))
|
||||
{
|
||||
char* s = InputBuf;
|
||||
Strtrim(s);
|
||||
Strtrimblanks(s);
|
||||
if (s[0])
|
||||
ExecCommand(s);
|
||||
strcpy(s, "");
|
||||
s[0] = 0;
|
||||
reclaim_focus = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -490,17 +490,18 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
// FIXME: Because inner_window's Scrollbar doesn't know about border size, since it's not encoded in window->WindowBorderSize,
|
||||
// it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with
|
||||
// different x/y values to BeginChild().
|
||||
const float border_size = TABLE_BORDER_SIZE;
|
||||
if (flags & ImGuiTableFlags_BordersOuterV)
|
||||
{
|
||||
table->HostClipRect.Min.x = ImMin(table->HostClipRect.Min.x + TABLE_BORDER_SIZE, table->HostClipRect.Max.x);
|
||||
table->HostClipRect.Min.x = ImMin(table->HostClipRect.Min.x + border_size, table->HostClipRect.Max.x);
|
||||
if (inner_window->DecoOuterSizeX2 == 0.0f)
|
||||
table->HostClipRect.Max.x = ImMax(table->HostClipRect.Max.x - TABLE_BORDER_SIZE, table->HostClipRect.Min.x);
|
||||
table->HostClipRect.Max.x = ImMax(table->HostClipRect.Max.x - border_size, table->HostClipRect.Min.x);
|
||||
}
|
||||
if (flags & ImGuiTableFlags_BordersOuterH)
|
||||
{
|
||||
table->HostClipRect.Min.y = ImMin(table->HostClipRect.Min.y + TABLE_BORDER_SIZE, table->HostClipRect.Max.y);
|
||||
table->HostClipRect.Min.y = ImMin(table->HostClipRect.Min.y + border_size, table->HostClipRect.Max.y);
|
||||
if (inner_window->DecoOuterSizeY2 == 0.0f)
|
||||
table->HostClipRect.Max.y = ImMax(table->HostClipRect.Max.y - TABLE_BORDER_SIZE, table->HostClipRect.Min.y);
|
||||
table->HostClipRect.Max.y = ImMax(table->HostClipRect.Max.y - border_size, table->HostClipRect.Min.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3626,7 +3627,7 @@ void ImGui::TableAngledHeadersRowEx(ImGuiID row_id, float angle, float max_label
|
||||
if (pass == 1)
|
||||
{
|
||||
// Draw border
|
||||
draw_list->AddLine(bg_shape[0], bg_shape[3], TableGetColumnBorderCol(table, order_n, column_n));
|
||||
draw_list->AddLine(bg_shape[0], bg_shape[3], TableGetColumnBorderCol(table, order_n, column_n), TABLE_BORDER_SIZE);
|
||||
}
|
||||
}
|
||||
PopClipRect();
|
||||
|
||||
Reference in New Issue
Block a user