Try to merge two last draw commands
| 479 | |
| 480 | // Try to merge two last draw commands |
| 481 | void ImDrawList::_TryMergeDrawCmds() |
| 482 | { |
| 483 | IM_ASSERT_PARANOID(CmdBuffer.Size > 0); |
| 484 | ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; |
| 485 | ImDrawCmd* prev_cmd = curr_cmd - 1; |
| 486 | if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && ImDrawCmd_AreSequentialIdxOffset(prev_cmd, curr_cmd) && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL) |
| 487 | { |
| 488 | prev_cmd->ElemCount += curr_cmd->ElemCount; |
| 489 | CmdBuffer.pop_back(); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | // Our scheme may appears a bit unusual, basically we want the most-common calls AddLine AddRect etc. to not have to perform any check so we always have a command ready in the stack. |
| 494 | // The cost of figuring out if a new command has to be added or if we can merge is paid in those Update** functions only. |
no test coverage detected