| 161 | } |
| 162 | |
| 163 | void CGraph::RenderDataLines(IGraphics *pGraphics, float x, float y, float w, float h) |
| 164 | { |
| 165 | if(m_pFirstScaled == nullptr) |
| 166 | { |
| 167 | return; |
| 168 | } |
| 169 | |
| 170 | IGraphics::CLineItemBatch LineItemBatch; |
| 171 | pGraphics->LinesBatchBegin(&LineItemBatch); |
| 172 | |
| 173 | const int64_t StartTime = m_pFirstScaled->m_Time; |
| 174 | |
| 175 | CEntry *pEntry0 = m_pFirstScaled; |
| 176 | int a0 = round_to_int((pEntry0->m_Time - StartTime) * w / m_RenderedTotalTime); |
| 177 | int v0 = round_to_int((pEntry0->m_Value - m_MinAxis) * h / (m_MaxAxis - m_MinAxis)); |
| 178 | while(pEntry0 != nullptr) |
| 179 | { |
| 180 | CEntry *pEntry1 = m_Entries.Next(pEntry0); |
| 181 | if(pEntry1 == nullptr) |
| 182 | break; |
| 183 | |
| 184 | const int a1 = round_to_int((pEntry1->m_Time - StartTime) * w / m_RenderedTotalTime); |
| 185 | const int v1 = round_to_int((pEntry1->m_Value - m_MinAxis) * h / (m_MaxAxis - m_MinAxis)); |
| 186 | |
| 187 | if(pEntry1->m_ApplyColor) |
| 188 | { |
| 189 | pGraphics->LinesBatchEnd(&LineItemBatch); |
| 190 | pGraphics->LinesBatchBegin(&LineItemBatch); |
| 191 | |
| 192 | const IGraphics::CColorVertex aColorVertices[] = { |
| 193 | IGraphics::CColorVertex(0, pEntry0->m_Color.r, pEntry0->m_Color.g, pEntry0->m_Color.b, pEntry0->m_Color.a), |
| 194 | IGraphics::CColorVertex(1, pEntry1->m_Color.r, pEntry1->m_Color.g, pEntry1->m_Color.b, pEntry1->m_Color.a)}; |
| 195 | pGraphics->SetColorVertex(aColorVertices, std::size(aColorVertices)); |
| 196 | } |
| 197 | const IGraphics::CLineItem Item = IGraphics::CLineItem( |
| 198 | x + a0, |
| 199 | y + h - v0, |
| 200 | x + a1, |
| 201 | y + h - v1); |
| 202 | pGraphics->LinesBatchDraw(&LineItemBatch, &Item, 1); |
| 203 | |
| 204 | pEntry0 = pEntry1; |
| 205 | a0 = a1; |
| 206 | v0 = v1; |
| 207 | } |
| 208 | pGraphics->LinesBatchEnd(&LineItemBatch); |
| 209 | } |
| 210 | |
| 211 | void CGraph::Render(IGraphics *pGraphics, ITextRender *pTextRender, float x, float y, float w, float h, const char *pDescription) |
| 212 | { |
nothing calls this directly
no test coverage detected