mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 22:26:34 +00:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp
This commit is contained in:
commit
13a5f5ba8b
@ -9,7 +9,7 @@ Individuals/hobbyists: support continued maintenance and development via the mon
|
||||
<br> [![Patreon](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/patreon_01.png)](http://www.patreon.com/imgui)
|
||||
|
||||
Individuals/hobbyists: support continued maintenance and development via PayPal:
|
||||
<br> [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
||||
<br> [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S)
|
||||
|
||||
Businesses: support continued maintenance and development via support contracts or sponsoring:
|
||||
<br> _E-mail: omarcornut at gmail dot com_
|
||||
@ -126,7 +126,7 @@ Languages: (third-party bindings)
|
||||
- Odin: [odin-dear_imgui](https://github.com/ThisDrunkDane/odin-dear_imgui)
|
||||
- Pascal: [imgui-pas](https://github.com/dpethes/imgui-pas)
|
||||
- PureBasic: [pb-cimgui](https://github.com/hippyau/pb-cimgui)
|
||||
- Python [CyImGui](https://github.com/chromy/cyimgui) or [pyimgui](https://github.com/swistakm/pyimgui)
|
||||
- Python: [pyimgui](https://github.com/swistakm/pyimgui) or [CyImGui](https://github.com/chromy/cyimgui)
|
||||
- Ruby: [ruby-imgui](https://github.com/vaiorabbit/ruby-imgui)
|
||||
- Rust: [imgui-rs](https://github.com/Gekkio/imgui-rs) or [imgui-rust](https://github.com/nsf/imgui-rust)
|
||||
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
||||
@ -289,7 +289,7 @@ Individuals/hobbyists: support continued maintenance and development via the mon
|
||||
<br> [![Patreon](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/patreon_01.png)](http://www.patreon.com/imgui)
|
||||
|
||||
Individuals/hobbyists: support continued maintenance and development via PayPal:
|
||||
<br> [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
||||
<br> [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S)
|
||||
|
||||
Businesses: support continued maintenance and development via support contracts or sponsoring:
|
||||
<br> _E-mail: omarcornut at gmail dot com_
|
||||
|
@ -150,14 +150,14 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
||||
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x + 0.5f;
|
||||
float T = draw_data->DisplayPos.y + 0.5f;
|
||||
float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y + 0.5f;
|
||||
D3DMATRIX mat_identity = { { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } };
|
||||
D3DMATRIX mat_identity = { { { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } } };
|
||||
D3DMATRIX mat_projection =
|
||||
{
|
||||
{ { {
|
||||
2.0f/(R-L), 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 2.0f/(T-B), 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.5f, 0.0f,
|
||||
(L+R)/(L-R), (T+B)/(B-T), 0.5f, 1.0f,
|
||||
};
|
||||
(L+R)/(L-R), (T+B)/(B-T), 0.5f, 1.0f
|
||||
} } };
|
||||
g_pd3dDevice->SetTransform(D3DTS_WORLD, &mat_identity);
|
||||
g_pd3dDevice->SetTransform(D3DTS_VIEW, &mat_identity);
|
||||
g_pd3dDevice->SetTransform(D3DTS_PROJECTION, &mat_projection);
|
||||
|
37
imgui.cpp
37
imgui.cpp
@ -1089,11 +1089,11 @@ ImGuiContext* GImGui = NULL;
|
||||
// If you use DLL hotreloading you might need to call SetAllocatorFunctions() after reloading code from this file.
|
||||
// Otherwise, you probably don't want to modify them mid-program, and if you use global/static e.g. ImVector<> instances you may need to keep them accessible during program destruction.
|
||||
#ifndef IMGUI_DISABLE_DEFAULT_ALLOCATORS
|
||||
static void* MallocWrapper(size_t size, void* user_data) { (void)user_data; return malloc(size); }
|
||||
static void FreeWrapper(void* ptr, void* user_data) { (void)user_data; free(ptr); }
|
||||
static void* MallocWrapper(size_t size, void* user_data) { IM_UNUSED(user_data); return malloc(size); }
|
||||
static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); free(ptr); }
|
||||
#else
|
||||
static void* MallocWrapper(size_t size, void* user_data) { (void)user_data; (void)size; IM_ASSERT(0); return NULL; }
|
||||
static void FreeWrapper(void* ptr, void* user_data) { (void)user_data; (void)ptr; IM_ASSERT(0); }
|
||||
static void* MallocWrapper(size_t size, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(size); IM_ASSERT(0); return NULL; }
|
||||
static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(ptr); IM_ASSERT(0); }
|
||||
#endif
|
||||
|
||||
static void* (*GImAllocatorAllocFunc)(size_t size, void* user_data) = MallocWrapper;
|
||||
@ -2762,9 +2762,9 @@ void ImGui::MarkItemEdited(ImGuiID id)
|
||||
{
|
||||
// This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().
|
||||
// ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data.
|
||||
(void)id; // Avoid unused variable warnings when asserts are compiled out.
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive);
|
||||
IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out.
|
||||
//IM_ASSERT(g.CurrentWindow->DC.LastItemId == id);
|
||||
g.ActiveIdHasBeenEdited = true;
|
||||
g.CurrentWindow->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_Edited;
|
||||
@ -4338,7 +4338,8 @@ int ImGui::CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_
|
||||
int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (key_index < 0) return false;
|
||||
if (key_index < 0)
|
||||
return 0;
|
||||
IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
||||
const float t = g.IO.KeysDownDuration[key_index];
|
||||
return CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, repeat_delay, repeat_rate);
|
||||
@ -4347,7 +4348,8 @@ int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_r
|
||||
bool ImGui::IsKeyPressed(int user_key_index, bool repeat)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (user_key_index < 0) return false;
|
||||
if (user_key_index < 0)
|
||||
return false;
|
||||
IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
||||
const float t = g.IO.KeysDownDuration[user_key_index];
|
||||
if (t == 0.0f)
|
||||
@ -4438,13 +4440,12 @@ ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup()
|
||||
return g.IO.MousePos;
|
||||
}
|
||||
|
||||
// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position
|
||||
// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position.
|
||||
bool ImGui::IsMousePosValid(const ImVec2* mouse_pos)
|
||||
{
|
||||
if (mouse_pos == NULL)
|
||||
mouse_pos = &GImGui->IO.MousePos;
|
||||
const float MOUSE_INVALID = -256000.0f;
|
||||
return mouse_pos->x >= MOUSE_INVALID && mouse_pos->y >= MOUSE_INVALID;
|
||||
ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos;
|
||||
return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID;
|
||||
}
|
||||
|
||||
// Return the delta from the initial clicking position.
|
||||
@ -5166,7 +5167,10 @@ void ImGui::UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags
|
||||
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
||||
window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;
|
||||
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
||||
{
|
||||
IM_ASSERT(window->RootWindowForNav->ParentWindow != NULL);
|
||||
window->RootWindowForNav = window->RootWindowForNav->ParentWindow;
|
||||
}
|
||||
}
|
||||
|
||||
// Push a new ImGui window to add widgets to.
|
||||
@ -5468,7 +5472,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// Position child window
|
||||
if (flags & ImGuiWindowFlags_ChildWindow)
|
||||
{
|
||||
IM_ASSERT(parent_window->Active);
|
||||
IM_ASSERT(parent_window && parent_window->Active);
|
||||
window->BeginOrderWithinParent = (short)parent_window->DC.ChildWindows.Size;
|
||||
parent_window->DC.ChildWindows.push_back(window);
|
||||
if (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !window_is_child_tooltip)
|
||||
@ -7525,7 +7529,7 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags fla
|
||||
|
||||
void ImGui::EndPopup()
|
||||
{
|
||||
ImGuiContext& g = *GImGui; (void)g;
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.CurrentWindow->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls
|
||||
IM_ASSERT(g.BeginPopupStack.Size > 0);
|
||||
|
||||
@ -8936,9 +8940,8 @@ static void ImGui::NavUpdate()
|
||||
NavUpdateWindowing();
|
||||
|
||||
// Set output flags for user application
|
||||
// FIXME: g.NavInitRequest is always false at this point, investigate the intent of operation done here.
|
||||
g.IO.NavActive = (nav_keyboard_active || nav_gamepad_active) && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs);
|
||||
g.IO.NavVisible = (g.IO.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL) || g.NavInitRequest;
|
||||
g.IO.NavVisible = (g.IO.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL);
|
||||
|
||||
// Process NavCancel input (to close a popup, get back to parent, clear focus)
|
||||
if (IsNavInputPressed(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed))
|
||||
@ -13712,7 +13715,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
{
|
||||
ImDrawVert& v = draw_list->VtxBuffer[idx_buffer ? idx_buffer[vtx_i] : vtx_i];
|
||||
triangles_pos[n] = v.pos;
|
||||
buf_p += ImFormatString(buf_p, (int)(buf_end - buf_p), "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n", (n == 0) ? "vtx" : " ", vtx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
|
||||
buf_p += ImFormatString(buf_p, buf_end - buf_p, "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n", (n == 0) ? "vtx" : " ", vtx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
|
||||
}
|
||||
ImGui::Selectable(buf, false);
|
||||
if (overlay_draw_list && ImGui::IsItemHovered())
|
||||
@ -13923,7 +13926,7 @@ void ImGui::ShowDockingDebug()
|
||||
|
||||
static void NodeTabBar(ImGuiTabBar* tab_bar)
|
||||
{
|
||||
// Note that standalone tab bars (not associated to docking/windows functionality) currently hold no discernable strings.
|
||||
// Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings.
|
||||
char buf[256];
|
||||
char* p = buf;
|
||||
const char* buf_end = buf + IM_ARRAYSIZE(buf);
|
||||
|
5
imgui.h
5
imgui.h
@ -75,6 +75,7 @@ Index of this file:
|
||||
#endif
|
||||
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) // Size of a static C-style array. Don't use on pointers!
|
||||
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in modern C++.
|
||||
#define IM_UNUSED(_VAR) ((void)_VAR) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
|
||||
|
||||
// Warnings
|
||||
#if defined(__clang__)
|
||||
@ -1582,7 +1583,7 @@ namespace ImGui
|
||||
// OBSOLETED in 1.60 (between Dec 2017 and Apr 2018)
|
||||
static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); }
|
||||
static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }
|
||||
static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { (void)on_edge; (void)outward; IM_ASSERT(0); return pos; }
|
||||
static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { IM_UNUSED(on_edge); IM_UNUSED(outward); IM_ASSERT(0); return pos; }
|
||||
// OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||
static inline void ShowTestWindow() { return ShowDemoWindow(); }
|
||||
static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); }
|
||||
@ -2033,7 +2034,7 @@ struct ImFontGlyphRangesBuilder
|
||||
{
|
||||
ImVector<int> UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used)
|
||||
|
||||
ImFontGlyphRangesBuilder() { UsedChars.resize(0x10000 / 32); memset(UsedChars.Data, 0, 0x10000 / 32); }
|
||||
ImFontGlyphRangesBuilder() { UsedChars.resize(0x10000 / sizeof(int)); memset(UsedChars.Data, 0, 0x10000 / sizeof(int)); }
|
||||
bool GetBit(int n) const { int off = (n >> 5); int mask = 1 << (n & 31); return (UsedChars[off] & mask) != 0; } // Get bit n in the array
|
||||
void SetBit(int n) { int off = (n >> 5); int mask = 1 << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array
|
||||
void AddChar(ImWchar c) { SetBit(c); } // Add character
|
||||
|
@ -932,12 +932,13 @@ static void ShowDemoWindowWidgets()
|
||||
ImGui::PushID(i);
|
||||
if (ImGui::Selectable("Sailor", &selected[i], 0, ImVec2(50,50)))
|
||||
{
|
||||
// Note: We _unnecessarily_ test for both x/y and i here only to silence some static analyzer. The second part of each test is unnecessary.
|
||||
int x = i % 4;
|
||||
int y = i / 4;
|
||||
if (x > 0) { selected[i - 1] ^= 1; }
|
||||
if (x < 3) { selected[i + 1] ^= 1; }
|
||||
if (y > 0) { selected[i - 4] ^= 1; }
|
||||
if (y < 3) { selected[i + 4] ^= 1; }
|
||||
if (x > 0) { selected[i - 1] ^= 1; }
|
||||
if (x < 3 && i < 15) { selected[i + 1] ^= 1; }
|
||||
if (y > 0 && i > 3) { selected[i - 4] ^= 1; }
|
||||
if (y < 3 && i < 12) { selected[i + 4] ^= 1; }
|
||||
}
|
||||
if ((i % 4) < 3) ImGui::SameLine();
|
||||
ImGui::PopID();
|
||||
@ -3178,7 +3179,7 @@ struct ExampleAppConsole
|
||||
// Portable helpers
|
||||
static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; }
|
||||
static int Strnicmp(const char* str1, const char* str2, int n) { int d = 0; while (n > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; n--; } return d; }
|
||||
static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buff = malloc(len); return (char*)memcpy(buff, (const void*)str, len); }
|
||||
static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buf = malloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)str, len); }
|
||||
static void Strtrim(char* str) { char* str_end = str + strlen(str); while (str_end > str && str_end[-1] == ' ') str_end--; *str_end = 0; }
|
||||
|
||||
void ClearLog()
|
||||
|
@ -695,7 +695,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
||||
PrimReserve(idx_count, vtx_count);
|
||||
|
||||
// Temporary buffer
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * (thick_line ? 5 : 3) * sizeof(ImVec2));
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * (thick_line ? 5 : 3) * sizeof(ImVec2)); //-V630
|
||||
ImVec2* temp_points = temp_normals + points_count;
|
||||
|
||||
for (int i1 = 0; i1 < count; i1++)
|
||||
@ -886,7 +886,7 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
|
||||
}
|
||||
|
||||
// Compute normals
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2));
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630
|
||||
for (int i0 = points_count-1, i1 = 0; i1 < points_count; i0 = i1++)
|
||||
{
|
||||
const ImVec2& p0 = points[i0];
|
||||
@ -2069,6 +2069,7 @@ void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* f
|
||||
void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque)
|
||||
{
|
||||
stbrp_context* pack_context = (stbrp_context*)stbrp_context_opaque;
|
||||
IM_ASSERT(pack_context != NULL);
|
||||
|
||||
ImVector<ImFontAtlas::CustomRect>& user_rects = atlas->CustomRects;
|
||||
IM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong.
|
||||
|
@ -191,7 +191,7 @@ IMGUI_API int ImFormatString(char* buf, size_t buf_size, const char* f
|
||||
IMGUI_API int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) IM_FMTLIST(3);
|
||||
IMGUI_API const char* ImParseFormatFindStart(const char* format);
|
||||
IMGUI_API const char* ImParseFormatFindEnd(const char* format);
|
||||
IMGUI_API const char* ImParseFormatTrimDecorations(const char* format, char* buf, int buf_size);
|
||||
IMGUI_API const char* ImParseFormatTrimDecorations(const char* format, char* buf, size_t buf_size);
|
||||
IMGUI_API int ImParseFormatPrecision(const char* format, int default_value);
|
||||
|
||||
// Helpers: ImVec2/ImVec4 operators
|
||||
|
@ -2608,7 +2608,7 @@ const char* ImParseFormatFindEnd(const char* fmt)
|
||||
// fmt = "%.3f" -> return fmt
|
||||
// fmt = "hello %.3f" -> return fmt + 6
|
||||
// fmt = "%.3f hello" -> return buf written with "%.3f"
|
||||
const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, int buf_size)
|
||||
const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, size_t buf_size)
|
||||
{
|
||||
const char* fmt_start = ImParseFormatFindStart(fmt);
|
||||
if (fmt_start[0] != '%')
|
||||
@ -2616,7 +2616,7 @@ const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, int buf_siz
|
||||
const char* fmt_end = ImParseFormatFindEnd(fmt_start);
|
||||
if (fmt_end[0] == 0) // If we only have leading decoration, we don't need to copy the data.
|
||||
return fmt_start;
|
||||
ImStrncpy(buf, fmt_start, ImMin((int)(fmt_end + 1 - fmt_start), buf_size));
|
||||
ImStrncpy(buf, fmt_start, ImMin((size_t)(fmt_end - fmt_start) + 1, buf_size));
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -4041,7 +4041,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
{
|
||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
|
||||
{
|
||||
memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any
|
||||
memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512
|
||||
value_changed = true;
|
||||
}
|
||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))
|
||||
@ -5521,7 +5521,7 @@ bool ImGui::BeginMainMenuBar()
|
||||
End();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true; //-V1020
|
||||
}
|
||||
|
||||
void ImGui::EndMainMenuBar()
|
||||
@ -6586,7 +6586,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
// Render tab label, process close button
|
||||
const ImGuiID close_button_id = p_open ? window->GetID((void*)((intptr_t)id + 1)) : 0;
|
||||
bool just_closed = TabItemLabelAndCloseButton(display_draw_list, bb, flags, label, id, close_button_id);
|
||||
if (just_closed)
|
||||
if (just_closed && p_open != NULL)
|
||||
{
|
||||
*p_open = false;
|
||||
TabBarCloseTab(tab_bar, tab);
|
||||
@ -6647,6 +6647,7 @@ void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabI
|
||||
// While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
|
||||
ImGuiContext& g = *GImGui;
|
||||
const float width = bb.GetWidth();
|
||||
IM_UNUSED(flags);
|
||||
IM_ASSERT(width > 0.0f);
|
||||
const float rounding = ImMax(0.0f, ImMin(g.Style.TabRounding, width * 0.5f - 1.0f));
|
||||
float y1 = bb.Min.y + 1.0f;
|
||||
|
@ -563,7 +563,6 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s
|
||||
|
||||
// now scan to find xpos
|
||||
find->x = r.x0;
|
||||
i = 0;
|
||||
for (i=0; first+i < n; ++i)
|
||||
find->x += STB_TEXTEDIT_GETWIDTH(str, first, i);
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
// [ImGui] this is a slightly modified version of stb_truetype.h 1.19. Those changes would need to be pushed into nothings/stb
|
||||
// grep for [ImGui] to find the changes.
|
||||
|
||||
// stb_truetype.h - v1.19 - public domain
|
||||
// authored from 2009-2016 by Sean Barrett / RAD Game Tools
|
||||
//
|
||||
@ -1825,7 +1828,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s
|
||||
if (comp_verts) STBTT_free(comp_verts, info->userdata);
|
||||
return 0;
|
||||
}
|
||||
if (num_vertices > 0) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex));
|
||||
if (num_vertices > 0) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); //-V595
|
||||
STBTT_memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex));
|
||||
if (vertices) STBTT_free(vertices, info->userdata);
|
||||
vertices = tmp;
|
||||
@ -2196,7 +2199,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st
|
||||
} break;
|
||||
|
||||
default:
|
||||
if (b0 != 255 && b0 != 28 && (b0 < 32 || b0 > 254))
|
||||
if (b0 != 255 && b0 != 28 && (b0 < 32 || b0 > 254)) //-V560
|
||||
return STBTT__CSERR("reserved operator");
|
||||
|
||||
// push immediate
|
||||
@ -2368,7 +2371,8 @@ static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph)
|
||||
if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount)
|
||||
return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID));
|
||||
|
||||
classDefTable = classDef1ValueArray + 2 * glyphCount;
|
||||
// [ImGui: commented to fix static analyzer warning]
|
||||
//classDefTable = classDef1ValueArray + 2 * glyphCount;
|
||||
} break;
|
||||
|
||||
case 2: {
|
||||
@ -2392,7 +2396,8 @@ static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph)
|
||||
return (stbtt_int32)ttUSHORT(classRangeRecord + 4);
|
||||
}
|
||||
|
||||
classDefTable = classRangeRecords + 6 * classRangeCount;
|
||||
// [ImGui: commented to fix static analyzer warning]
|
||||
//classDefTable = classRangeRecords + 6 * classRangeCount;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
@ -3024,6 +3029,7 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill,
|
||||
dx = -dx;
|
||||
dy = -dy;
|
||||
t = x0, x0 = xb, xb = t;
|
||||
(void)dx; // [ImGui: fix static analyzer warning]
|
||||
}
|
||||
|
||||
x1 = (int) x_top;
|
||||
@ -4253,7 +4259,7 @@ static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex
|
||||
int winding = 0;
|
||||
|
||||
orig[0] = x;
|
||||
orig[1] = y;
|
||||
//orig[1] = y; // [ImGui] commmented double assignment without reading
|
||||
|
||||
// make sure y never passes through a vertex of the shape
|
||||
y_frac = (float) STBTT_fmod(y, 1.0f);
|
||||
|
@ -569,8 +569,8 @@ bool ImFontAtlasBuildWithFreeType(FT_Library ft_library, ImFontAtlas* atlas, uns
|
||||
}
|
||||
|
||||
// Default memory allocators
|
||||
static void* ImFreeTypeDefaultAllocFunc(size_t size, void* user_data) { (void)user_data; return ImGui::MemAlloc(size); }
|
||||
static void ImFreeTypeDefaultFreeFunc(void* ptr, void* user_data) { (void)user_data; ImGui::MemFree(ptr); }
|
||||
static void* ImFreeTypeDefaultAllocFunc(size_t size, void* user_data) { IM_UNUSED(user_data); return ImGui::MemAlloc(size); }
|
||||
static void ImFreeTypeDefaultFreeFunc(void* ptr, void* user_data) { IM_UNUSED(user_data); ImGui::MemFree(ptr); }
|
||||
|
||||
// Current memory allocators
|
||||
static void* (*GImFreeTypeAllocFunc)(size_t size, void* user_data) = ImFreeTypeDefaultAllocFunc;
|
||||
|
Loading…
Reference in New Issue
Block a user