MCPcopy Create free account
hub / github.com/baldurk/renderdoc / makePath

Method makePath

qrenderdoc/Windows/TimelineBar.cpp:71–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 }
70
71 QPainterPath makePath(const int triRadius, const int triHeight, qreal y)
72 {
73 QPainterPath path;
74
75 for(const QPair<qreal, qreal> &range : ranges)
76 {
77 if(range.first == range.second)
78 {
79 QPointF pos = aliasAlign(QPointF(range.first, y));
80
81 QPainterPath triangle;
82 triangle.addPolygon(
83 QPolygonF({pos + QPoint(0, triHeight), pos + QPoint(triRadius * 2, triHeight),
84 pos + QPoint(triRadius, 0)}));
85 triangle.closeSubpath();
86
87 path = path.united(triangle);
88 }
89 else
90 {
91 QPointF left = aliasAlign(QPointF(range.first, y));
92 QPointF right = aliasAlign(QPointF(range.second, y));
93
94 QPainterPath trapezoid;
95 trapezoid.addPolygon(
96 QPolygonF({left + QPoint(0, triHeight), right + QPoint(triRadius * 2, triHeight),
97 right + QPoint(triRadius, 0), left + QPoint(triRadius, 0)}));
98 trapezoid.closeSubpath();
99
100 path = path.united(trapezoid);
101 }
102 }
103
104 return path;
105 }
106
107private:
108 QVector<QPair<qreal, qreal>> ranges;

Callers 1

paintEventMethod · 0.45

Calls 6

aliasAlignFunction · 0.85
closeSubpathMethod · 0.80
unitedMethod · 0.80
QPointFClass · 0.50
QPolygonFFunction · 0.50
QPointClass · 0.50

Tested by

no test coverage detected