@ -514,6 +514,21 @@ void ImDrawList::_OnChangedTextureID()
curr_cmd - > TextureId = _CmdHeader . TextureId ;
curr_cmd - > TextureId = _CmdHeader . TextureId ;
}
}
void ImDrawList : : _OnChangedVtxOffset ( )
{
// We don't need to compare curr_cmd->VtxOffset != _CmdHeader.VtxOffset because we know it'll be different at the time we call this.
_VtxCurrentIdx = 0 ;
ImDrawCmd * curr_cmd = & CmdBuffer . Data [ CmdBuffer . Size - 1 ] ;
IM_ASSERT ( curr_cmd - > VtxOffset ! = _CmdHeader . VtxOffset ) ;
if ( curr_cmd - > ElemCount ! = 0 )
{
AddDrawCmd ( ) ;
return ;
}
IM_ASSERT ( curr_cmd - > UserCallback = = NULL ) ;
curr_cmd - > VtxOffset = _CmdHeader . VtxOffset ;
}
// Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
// Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
void ImDrawList : : PushClipRect ( ImVec2 cr_min , ImVec2 cr_max , bool intersect_with_current_clip_rect )
void ImDrawList : : PushClipRect ( ImVec2 cr_min , ImVec2 cr_max , bool intersect_with_current_clip_rect )
{
{
@ -570,8 +585,7 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count)
if ( sizeof ( ImDrawIdx ) = = 2 & & ( _VtxCurrentIdx + vtx_count > = ( 1 < < 16 ) ) & & ( Flags & ImDrawListFlags_AllowVtxOffset ) )
if ( sizeof ( ImDrawIdx ) = = 2 & & ( _VtxCurrentIdx + vtx_count > = ( 1 < < 16 ) ) & & ( Flags & ImDrawListFlags_AllowVtxOffset ) )
{
{
_CmdHeader . VtxOffset = VtxBuffer . Size ;
_CmdHeader . VtxOffset = VtxBuffer . Size ;
_VtxCurrentIdx = 0 ;
_OnChangedVtxOffset ( ) ;
AddDrawCmd ( ) ;
}
}
ImDrawCmd * draw_cmd = & CmdBuffer . Data [ CmdBuffer . Size - 1 ] ;
ImDrawCmd * draw_cmd = & CmdBuffer . Data [ CmdBuffer . Size - 1 ] ;