MCPcopy Create free account
hub / github.com/ddnet/ddnet / InsertAt

Method InsertAt

src/engine/client/graph.cpp:135–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void CGraph::InsertAt(int64_t Time, float Value, ColorRGBA Color)
136{
137 CEntry *pEntry = m_Entries.Allocate(sizeof(CEntry));
138 pEntry->m_Time = Time;
139 pEntry->m_Value = Value;
140 pEntry->m_Color = Color;
141
142 // Determine whether the line (pPrev, pEntry) has different
143 // vertex colors than the line (pPrevPrev, pPrev).
144 CEntry *pPrev = m_Entries.Prev(pEntry);
145 if(pPrev == nullptr)
146 {
147 pEntry->m_ApplyColor = true;
148 }
149 else
150 {
151 CEntry *pPrevPrev = m_Entries.Prev(pPrev);
152 if(pPrevPrev == nullptr)
153 {
154 pEntry->m_ApplyColor = true;
155 }
156 else
157 {
158 pEntry->m_ApplyColor = Color != pPrev->m_Color || pPrev->m_Color != pPrevPrev->m_Color;
159 }
160 }
161}
162
163void CGraph::RenderDataLines(IGraphics *pGraphics, float x, float y, float w, float h)
164{

Callers 1

RenderTuningMethod · 0.80

Calls 2

AllocateMethod · 0.45
PrevMethod · 0.45

Tested by

no test coverage detected