mirror of
https://github.com/ocornut/imgui.git
synced 2026-05-31 14:25:49 +08:00
ImDrawList: harden/clarify static asserts about ImDrawCmd / ImDrawCmdHeader layout.
This commit is contained in:
+4
-1
@@ -444,10 +444,13 @@ void ImDrawList::_SetDrawListSharedData(ImDrawListSharedData* data)
|
|||||||
// In the majority of cases, you would want to call PushClipRect() and PushTexture() after this.
|
// In the majority of cases, you would want to call PushClipRect() and PushTexture() after this.
|
||||||
void ImDrawList::_ResetForNewFrame()
|
void ImDrawList::_ResetForNewFrame()
|
||||||
{
|
{
|
||||||
// Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory.
|
// Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory to match ImDrawCmdHeader.
|
||||||
IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0);
|
IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0);
|
||||||
IM_STATIC_ASSERT(offsetof(ImDrawCmd, TexRef) == sizeof(ImVec4));
|
IM_STATIC_ASSERT(offsetof(ImDrawCmd, TexRef) == sizeof(ImVec4));
|
||||||
IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureRef));
|
IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureRef));
|
||||||
|
IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == offsetof(ImDrawCmdHeader, ClipRect));
|
||||||
|
IM_STATIC_ASSERT(offsetof(ImDrawCmd, TexRef) == offsetof(ImDrawCmdHeader, TexRef));
|
||||||
|
IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == offsetof(ImDrawCmdHeader, VtxOffset));
|
||||||
if (_Splitter._Count > 1)
|
if (_Splitter._Count > 1)
|
||||||
_Splitter.Merge(this);
|
_Splitter.Merge(this);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user