mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-14 17:07:01 +00:00
ImVector: added find, find_erase, find_erase_unsorted helpers.
This commit is contained in:
parent
eab03f4467
commit
f47a0a85cc
@ -41,11 +41,11 @@ Other Changes:
|
||||
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
|
||||
Note that some elements won't accurately fade down with the same intensity, and the color wheel
|
||||
when enabled will have small overlap glitches with (style.Alpha < 1.0).
|
||||
- TabBar: fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
|
||||
- TabBar: fixed single-tab not shrinking their width down.
|
||||
- TabBar: feed desired width (sum of unclipped tabs width) into layout system to allow for auto-resize. (#2768)
|
||||
- TabBar: Fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
|
||||
- TabBar: Fixed single-tab not shrinking their width down.
|
||||
- TabBar: Feed desired width (sum of unclipped tabs width) into layout system to allow for auto-resize. (#2768)
|
||||
(before 1.71 tab bars fed the sum of current width which created feedback loops in certain situations).
|
||||
- TabBar: improved shrinking for large number of tabs to avoid leaving extraneous space on the right side.
|
||||
- TabBar: Improved shrinking for large number of tabs to avoid leaving extraneous space on the right side.
|
||||
Individuals tabs are given integer-rounded width and remainder is spread between tabs left-to-right.
|
||||
- Columns, Separator: Fixed a bug where non-visible separators within columns would alter the next row position
|
||||
differently than visible ones.
|
||||
@ -65,9 +65,10 @@ Other Changes:
|
||||
unfitting with many types of fonts) we first attempt to find a standard ellipsis glyphs within the loaded set.
|
||||
Otherwise we render ellipsis using '.' from the font from where we trim excessive spacing to make it as narrow
|
||||
as possible. (#2775) [@rokups]
|
||||
- ImDrawList: clarified the name of many parameters so reading the code is a little easier. (#2740)
|
||||
- ImDrawList: Clarified the name of many parameters so reading the code is a little easier. (#2740)
|
||||
- ImDrawListSplitter: fixed an issue merging channels if the last submitted draw command used a different texture. (#2506)
|
||||
- Using offsetof() when available in C++11. Avoids Clang sanitizer complaining about old-style macros. (#94)
|
||||
- ImVector: Added find(), find_erase(), find_erase_unsorted() helpers.
|
||||
- Added a mechanism to compact/free the larger allocations of unused windows (buffers are compacted when
|
||||
a window is unused for 60 seconds, as per io.ConfigWindowsMemoryCompactTimer = 60.0f). Note that memory
|
||||
usage has never been reported as a problem, so this is merely a touch of overzealous luxury. (#2636)
|
||||
|
4
imgui.h
4
imgui.h
@ -1273,6 +1273,10 @@ struct ImVector
|
||||
inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
|
||||
inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
|
||||
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
||||
inline T* find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }
|
||||
inline const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }
|
||||
inline bool find_erase(const T& v) { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; }
|
||||
inline bool find_erase_unsorted(const T& v) { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; }
|
||||
inline int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user