Skip to content

Commit 0e6bb15

Browse files
committed
ImDrawList: remove local vs member indirection as locals were deemed better. (2)
1 parent 3948cd0 commit 0e6bb15

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

imgui_draw.cpp

+14-9
Original file line numberDiff line numberDiff line change
@@ -731,22 +731,27 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c
731731
#define IM_POLYLINE_IDX_16_BIT 0
732732
#else
733733
#define IM_POLYLINE_IDX_16_BIT 1
734-
# endif
735-
736-
// Macros that declare, load and save write pointers as local variables
737-
#define IM_POLYLINE_PRIM_MAKE_LOCAL() ImDrawVert* vtx_write = this->_VtxWritePtr; ImDrawIdx* idx_write = this->_IdxWritePtr; unsigned int idx_base = this->_VtxCurrentIdx
738-
#define IM_POLYLINE_PRIM_LOAD_LOCAL() vtx_write = this->_VtxWritePtr; idx_write = this->_IdxWritePtr; idx_base = this->_VtxCurrentIdx
739-
#define IM_POLYLINE_PRIM_SAVE_LOCAL() this->_VtxWritePtr = vtx_write; this->_IdxWritePtr = idx_write; this->_VtxCurrentIdx = idx_base
734+
#endif
740735

741736
// Macros that commit, split and handle vertex offset overflow
742-
#define IM_POLYLINE_PRIM_RESERVE(IDX_COUNT, VTX_COUNT) this->PrimReserve((IDX_COUNT) + IM_POLYLINE_PRIM_EXTRA_IDX_COUNT, VTX_COUNT); IM_POLYLINE_PRIM_MAKE_LOCAL()
737+
#define IM_POLYLINE_PRIM_RESERVE(IDX_COUNT, VTX_COUNT) \
738+
this->PrimReserve((IDX_COUNT) + IM_POLYLINE_PRIM_EXTRA_IDX_COUNT, VTX_COUNT); \
739+
ImDrawVert* vtx_write = this->_VtxWritePtr; \
740+
ImDrawIdx* idx_write = this->_IdxWritePtr; \
741+
unsigned int idx_base = this->_VtxCurrentIdx;
742+
743743
#define IM_POLYLINE_PRIM_COMMIT() \
744-
IM_POLYLINE_PRIM_SAVE_LOCAL(); \
744+
this->_VtxWritePtr = vtx_write; this->_IdxWritePtr = idx_write; this->_VtxCurrentIdx = idx_base; \
745745
const int unused_vtx_count = (int)((this->VtxBuffer.Data + this->VtxBuffer.Size) - this->_VtxWritePtr); \
746746
const int unused_idx_count = (int)((this->IdxBuffer.Data + this->IdxBuffer.Size) - this->_IdxWritePtr); \
747747
this->PrimUnreserve(unused_idx_count, unused_vtx_count)
748748

749-
#define IM_POLYLINE_PRIM_SPLT() IM_POLYLINE_PRIM_COMMIT(); this->PrimReserve(unused_idx_count, unused_vtx_count); IM_POLYLINE_PRIM_LOAD_LOCAL()
749+
#define IM_POLYLINE_PRIM_SPLT() \
750+
IM_POLYLINE_PRIM_COMMIT(); \
751+
this->PrimReserve(unused_idx_count, unused_vtx_count); \
752+
vtx_write = this->_VtxWritePtr; \
753+
idx_write = this->_IdxWritePtr; \
754+
idx_base = this->_VtxCurrentIdx;
750755

751756
#define IM_POLYLINE_VTX_COMMIT(N) \
752757
{ \

0 commit comments

Comments
 (0)