mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	ImDrawList: Prefixed internal functions with underscore, renamed UpdateClipRect() to _OnChangedClipRect(), UpdateTextureID() -> _OnChangedTextureID()
This commit is contained in:
		| @@ -377,7 +377,7 @@ void ImDrawListSharedData::SetCircleSegmentMaxError(float max_error) | ||||
| } | ||||
|  | ||||
| // Initialize before use in a new frame. We always have a command ready in the buffer. | ||||
| void ImDrawList::ResetForNewFrame() | ||||
| void ImDrawList::_ResetForNewFrame() | ||||
| { | ||||
|     // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory. | ||||
|     // (those should be IM_STATIC_ASSERT() in theory but with our pre C++11 setup the whole check doesn't compile with GCC) | ||||
| @@ -400,7 +400,7 @@ void ImDrawList::ResetForNewFrame() | ||||
|     CmdBuffer.push_back(ImDrawCmd()); | ||||
| } | ||||
|  | ||||
| void ImDrawList::ClearFreeMemory() | ||||
| void ImDrawList::_ClearFreeMemory() | ||||
| { | ||||
|     CmdBuffer.clear(); | ||||
|     IdxBuffer.clear(); | ||||
| @@ -439,7 +439,7 @@ void ImDrawList::AddDrawCmd() | ||||
|  | ||||
| // Pop trailing draw command (used before merging or presenting to user) | ||||
| // Note that this leaves the ImDrawList in a state unfit for further commands, as most code assume that CmdBuffer.Size > 0 && CmdBuffer.back().UserCallback == NULL | ||||
| void ImDrawList::PopUnusedDrawCmd() | ||||
| void ImDrawList::_PopUnusedDrawCmd() | ||||
| { | ||||
|     if (CmdBuffer.Size == 0) | ||||
|         return; | ||||
| @@ -469,7 +469,7 @@ void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data) | ||||
|  | ||||
| // 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. | ||||
| // 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. | ||||
| void ImDrawList::UpdateClipRect() | ||||
| void ImDrawList::_OnChangedClipRect() | ||||
| { | ||||
|     // If current command is used with different settings we need to add a new command | ||||
|     ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; | ||||
| @@ -490,7 +490,7 @@ void ImDrawList::UpdateClipRect() | ||||
|     curr_cmd->ClipRect = _CmdHeader.ClipRect; | ||||
| } | ||||
|  | ||||
| void ImDrawList::UpdateTextureID() | ||||
| void ImDrawList::_OnChangedTextureID() | ||||
| { | ||||
|     // If current command is used with different settings we need to add a new command | ||||
|     ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; | ||||
| @@ -528,7 +528,7 @@ void ImDrawList::PushClipRect(ImVec2 cr_min, ImVec2 cr_max, bool intersect_with_ | ||||
|  | ||||
|     _ClipRectStack.push_back(cr); | ||||
|     _CmdHeader.ClipRect = cr; | ||||
|     UpdateClipRect(); | ||||
|     _OnChangedClipRect(); | ||||
| } | ||||
|  | ||||
| void ImDrawList::PushClipRectFullScreen() | ||||
| @@ -540,21 +540,21 @@ void ImDrawList::PopClipRect() | ||||
| { | ||||
|     _ClipRectStack.pop_back(); | ||||
|     _CmdHeader.ClipRect = (_ClipRectStack.Size == 0) ? _Data->ClipRectFullscreen : _ClipRectStack.Data[_ClipRectStack.Size - 1]; | ||||
|     UpdateClipRect(); | ||||
|     _OnChangedClipRect(); | ||||
| } | ||||
|  | ||||
| void ImDrawList::PushTextureID(ImTextureID texture_id) | ||||
| { | ||||
|     _TextureIdStack.push_back(texture_id); | ||||
|     _CmdHeader.TextureId = texture_id; | ||||
|     UpdateTextureID(); | ||||
|     _OnChangedTextureID(); | ||||
| } | ||||
|  | ||||
| void ImDrawList::PopTextureID() | ||||
| { | ||||
|     _TextureIdStack.pop_back(); | ||||
|     _CmdHeader.TextureId = (_TextureIdStack.Size == 0) ? (ImTextureID)NULL : _TextureIdStack.Data[_TextureIdStack.Size - 1]; | ||||
|     UpdateTextureID(); | ||||
|     _OnChangedTextureID(); | ||||
| } | ||||
|  | ||||
| // Reserve space for a number of vertices and indices. | ||||
| @@ -1378,7 +1378,7 @@ void ImDrawListSplitter::Merge(ImDrawList* draw_list) | ||||
|         return; | ||||
|  | ||||
|     SetCurrentChannel(draw_list, 0); | ||||
|     draw_list->PopUnusedDrawCmd(); | ||||
|     draw_list->_PopUnusedDrawCmd(); | ||||
|  | ||||
|     // Calculate our final buffer sizes. Also fix the incorrect IdxOffset values in each command. | ||||
|     int new_cmd_buffer_count = 0; | ||||
| @@ -1427,8 +1427,8 @@ void ImDrawListSplitter::Merge(ImDrawList* draw_list) | ||||
|         if (int sz = ch._IdxBuffer.Size) { memcpy(idx_write, ch._IdxBuffer.Data, sz * sizeof(ImDrawIdx)); idx_write += sz; } | ||||
|     } | ||||
|     draw_list->_IdxWritePtr = idx_write; | ||||
|     draw_list->UpdateClipRect(); // We call this instead of AddDrawCmd(), so that empty channels won't produce an extra draw call. | ||||
|     draw_list->UpdateTextureID(); | ||||
|     draw_list->_OnChangedClipRect(); // We call this instead of AddDrawCmd(), so that empty channels won't produce an extra draw call. | ||||
|     draw_list->_OnChangedTextureID(); | ||||
|     _Count = 1; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user