ImDrawList: Fixed an issue when draw command merging or cancelling while crossing the VtxOffset boundary would lead to draw command being emitted with wrong VtxOffset value. (#3129, #3163, #3232)
This commit is contained in:
parent
78d5ccfb90
commit
e22e3f300a
@ -56,6 +56,9 @@ Other Changes:
|
|||||||
BeginMenu()/EndMenu() or BeginPopup/EndPopup(). (#3223, #1207) [@rokups]
|
BeginMenu()/EndMenu() or BeginPopup/EndPopup(). (#3223, #1207) [@rokups]
|
||||||
- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
|
- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
|
||||||
drag source uses _SourceNoPreviewTooltip flags. (#3160) [@rokups]
|
drag source uses _SourceNoPreviewTooltip flags. (#3160) [@rokups]
|
||||||
|
- ImDrawList: Fixed an issue when draw command merging or cancelling while crossing the VtxOffset
|
||||||
|
boundary would lead to draw command being emitted with wrong VtxOffset value. (#3129, #3163, #3232)
|
||||||
|
[@thedmd, @Shironekoben, @sergeyn, @ocornut]
|
||||||
- Misc, Freetype: Fix for rare case where FT_Get_Char_Index() succeed but FT_Load_Glyph() fails.
|
- Misc, Freetype: Fix for rare case where FT_Get_Char_Index() succeed but FT_Load_Glyph() fails.
|
||||||
- CI: Added CI test to verify we're never accidentally dragging libstdc++ (on some compiler setups,
|
- CI: Added CI test to verify we're never accidentally dragging libstdc++ (on some compiler setups,
|
||||||
static constructors for non-pod data seems to drag in libstdc++ due to thread-safety concerns).
|
static constructors for non-pod data seems to drag in libstdc++ due to thread-safety concerns).
|
||||||
|
@ -10267,7 +10267,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
|
|
||||||
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
|
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
|
||||||
char buf[300];
|
char buf[300];
|
||||||
ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd: %4d triangles, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd:%5d triangles, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
|
||||||
pcmd->ElemCount/3, (void*)(intptr_t)pcmd->TextureId,
|
pcmd->ElemCount/3, (void*)(intptr_t)pcmd->TextureId,
|
||||||
pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
||||||
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
|
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
|
||||||
|
@ -460,11 +460,17 @@ void ImDrawList::UpdateClipRect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to merge with previous command if it matches, else use current command
|
// Try to merge with previous command if it matches, else use current command
|
||||||
ImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;
|
if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1)
|
||||||
if (curr_cmd->ElemCount == 0 && prev_cmd && memcmp(&prev_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) == 0 && prev_cmd->TextureId == GetCurrentTextureId() && prev_cmd->UserCallback == NULL)
|
{
|
||||||
CmdBuffer.pop_back();
|
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
||||||
else
|
if (memcmp(&prev_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) == 0 && prev_cmd->VtxOffset == _VtxCurrentOffset && prev_cmd->TextureId == GetCurrentTextureId() && prev_cmd->UserCallback == NULL)
|
||||||
curr_cmd->ClipRect = curr_clip_rect;
|
{
|
||||||
|
CmdBuffer.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curr_cmd->ClipRect = curr_clip_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::UpdateTextureID()
|
void ImDrawList::UpdateTextureID()
|
||||||
@ -479,11 +485,17 @@ void ImDrawList::UpdateTextureID()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to merge with previous command if it matches, else use current command
|
// Try to merge with previous command if it matches, else use current command
|
||||||
ImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;
|
if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1)
|
||||||
if (curr_cmd->ElemCount == 0 && prev_cmd && prev_cmd->TextureId == curr_texture_id && memcmp(&prev_cmd->ClipRect, &GetCurrentClipRect(), sizeof(ImVec4)) == 0 && prev_cmd->UserCallback == NULL)
|
{
|
||||||
CmdBuffer.pop_back();
|
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
||||||
else
|
if (prev_cmd->TextureId == curr_texture_id && memcmp(&prev_cmd->ClipRect, &GetCurrentClipRect(), sizeof(ImVec4)) == 0 && prev_cmd->VtxOffset == _VtxCurrentOffset && prev_cmd->UserCallback == NULL)
|
||||||
curr_cmd->TextureId = curr_texture_id;
|
{
|
||||||
|
CmdBuffer.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curr_cmd->TextureId = curr_texture_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef GetCurrentClipRect
|
#undef GetCurrentClipRect
|
||||||
|
Loading…
Reference in New Issue
Block a user