MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / UpdateTextureID

Method UpdateTextureID

lib/imgui/imgui_draw.cpp:470–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470void ImDrawList::UpdateTextureID()
471{
472 // If current command is used with different settings we need to add a new command
473 const ImTextureID curr_texture_id = GetCurrentTextureId();
474 ImDrawCmd* curr_cmd = CmdBuffer.Size ? &CmdBuffer.back() : NULL;
475 if (!curr_cmd || (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != curr_texture_id) || curr_cmd->UserCallback != NULL)
476 {
477 AddDrawCmd();
478 return;
479 }
480
481 // Try to merge with previous command if it matches, else use current command
482 ImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;
483 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)
484 CmdBuffer.pop_back();
485 else
486 curr_cmd->TextureId = curr_texture_id;
487}
488
489#undef GetCurrentClipRect
490#undef GetCurrentTextureId

Callers 1

MergeMethod · 0.80

Calls 2

pop_backMethod · 0.80
backMethod · 0.45

Tested by

no test coverage detected