ImDrawList: Added Clone() helper function.

This commit is contained in:
omar
2018-03-17 21:10:40 +01:00
parent 4186c2c2b1
commit 1e296453ef
3 changed files with 21 additions and 8 deletions

View File

@ -338,6 +338,16 @@ void ImDrawList::ClearFreeMemory()
_Channels.clear();
}
ImDrawList* ImDrawList::CloneOutput() const
{
ImDrawList* dst = IM_NEW(ImDrawList(NULL));
dst->CmdBuffer = CmdBuffer;
dst->IdxBuffer = IdxBuffer;
dst->VtxBuffer = VtxBuffer;
dst->Flags = Flags;
return dst;
}
// Using macros because C++ is a terrible language, we want guaranteed inline, no code in header, and no overhead in Debug builds
#define GetCurrentClipRect() (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1] : _Data->ClipRectFullscreen)
#define GetCurrentTextureId() (_TextureIdStack.Size ? _TextureIdStack.Data[_TextureIdStack.Size-1] : NULL)