TODO: better handling of clipping edges (floor + 1)
| 8 | { |
| 9 | // TODO: better handling of clipping edges (floor + 1) |
| 10 | void PlotElement::DrawGrid(Graphics& gfx, const Rect& port, int hDivs, int vDivs, Color gridColor) |
| 11 | { |
| 12 | if (gridColor.a == 0.f) |
| 13 | { |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | const auto dims = port.GetDimensions(); |
| 18 | gfx.FastLineBatchStart(port); |
| 19 | for (int i = 1; i < vDivs; i++) |
| 20 | { |
| 21 | const auto y = port.top + float(i) * (dims.height / float(vDivs)); |
| 22 | gfx.FastLineStart({ port.left, y }, gridColor); |
| 23 | gfx.FastLineEnd({ port.right, y }); |
| 24 | } |
| 25 | for (int i = 1; i < hDivs; i++) |
| 26 | { |
| 27 | auto x = port.left + float(i) * (dims.width / float(hDivs)); |
| 28 | gfx.FastLineStart({ x, port.top }, gridColor); |
| 29 | gfx.FastLineEnd({ x, port.bottom }); |
| 30 | } |
| 31 | gfx.FastBatchEnd(); |
| 32 | } |
| 33 | } |
nothing calls this directly
no test coverage detected