mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
ImDrawList merging commands with same texture
This commit is contained in:
parent
3e30ad3802
commit
edee014ab8
12
imgui.cpp
12
imgui.cpp
@ -5928,11 +5928,12 @@ void ImDrawList::Clear()
|
||||
|
||||
void ImDrawList::SetClipRect(const ImVec4& clip_rect)
|
||||
{
|
||||
if (!commands.empty() && commands.back().vtx_count == 0)
|
||||
ImDrawCmd* current_cmd = commands.empty() ? NULL : &commands.back();
|
||||
if (current_cmd && current_cmd->vtx_count == 0)
|
||||
{
|
||||
// Reuse existing command (high-level clipping may have discarded vertices submitted earlier)
|
||||
// FIXME-OPT: Possibly even reuse previous command.
|
||||
commands.back().clip_rect = clip_rect;
|
||||
current_cmd->clip_rect = clip_rect;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5959,11 +5960,12 @@ void ImDrawList::PopClipRect()
|
||||
|
||||
void ImDrawList::SetTextureID(const ImTextureID& texture_id)
|
||||
{
|
||||
if (!commands.empty() && commands.back().vtx_count == 0)
|
||||
ImDrawCmd* current_cmd = commands.empty() ? NULL : &commands.back();
|
||||
if (current_cmd && (current_cmd->vtx_count == 0 || current_cmd->texture_id == texture_id))
|
||||
{
|
||||
// Reuse existing command (high-level clipping may have discarded vertices submitted earlier)
|
||||
// Reuse existing command
|
||||
// FIXME-OPT: Possibly even reuse previous command.
|
||||
commands.back().texture_id = texture_id;
|
||||
current_cmd->texture_id = texture_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user