mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	InputText, ImDrawList: Fixed assert triggering when drawing single line of text with more than ~16 KB characters. (#3349)
This commit is contained in:
		| @@ -517,7 +517,7 @@ 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); | ||||
|     //IM_ASSERT(curr_cmd->VtxOffset != _CmdHeader.VtxOffset); // See #3349 | ||||
|     if (curr_cmd->ElemCount != 0) | ||||
|     { | ||||
|         AddDrawCmd(); | ||||
| @@ -582,6 +582,9 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count) | ||||
|     IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0); | ||||
|     if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset)) | ||||
|     { | ||||
|         // FIXME: In theory we should be testing that vtx_count <64k here. | ||||
|         // In practice, RenderText() relies on reserving ahead for a worst case scenario so it is currently useful for us | ||||
|         // to not make that check until we rework the text functions to handle clipping and large horizontal lines better. | ||||
|         _CmdHeader.VtxOffset = VtxBuffer.Size; | ||||
|         _OnChangedVtxOffset(); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user