MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / DrawGrid

Method DrawGrid

IntelPresentMon/Core/source/gfx/layout/PlotElement.cpp:10–32  ·  view source on GitHub ↗

TODO: better handling of clipping edges (floor + 1)

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 5

GetDimensionsMethod · 0.80
FastLineBatchStartMethod · 0.80
FastLineStartMethod · 0.80
FastLineEndMethod · 0.80
FastBatchEndMethod · 0.80

Tested by

no test coverage detected