qopengl2pexvertexarray.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopengl2pexvertexarray.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5void QOpenGL2PEXVertexArray::clear()-
6{-
7 vertexArray.reset();-
8 vertexArrayStops.reset();-
9 boundingRectDirty = true;-
10}
never executed: end of block
0
11-
12-
13QOpenGLRect QOpenGL2PEXVertexArray::boundingRect() const-
14{-
15 if (boundingRectDirty
boundingRectDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
16 return
never executed: return QOpenGLRect(0.0, 0.0, 0.0, 0.0);
QOpenGLRect(0.0, 0.0, 0.0, 0.0);
never executed: return QOpenGLRect(0.0, 0.0, 0.0, 0.0);
0
17 else-
18 return
never executed: return QOpenGLRect(minX, minY, maxX, maxY);
QOpenGLRect(minX, minY, maxX, maxY);
never executed: return QOpenGLRect(minX, minY, maxX, maxY);
0
19}-
20-
21void QOpenGL2PEXVertexArray::addClosingLine(int index)-
22{-
23 QPointF point(vertexArray.at(index));-
24 if (point != QPointF(vertexArray.last())
point != QPoin...xArray.last())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
25 vertexArray.add(point);
never executed: vertexArray.add(point);
0
26}
never executed: end of block
0
27-
28void QOpenGL2PEXVertexArray::addCentroid(const QVectorPath &path, int subPathIndex)-
29{-
30 const QPointF *const points = reinterpret_cast<const QPointF *>(path.points());-
31 const QPainterPath::ElementType *const elements = path.elements();-
32-
33 QPointF sum = points[subPathIndex];-
34 int count = 1;-
35-
36 for (int i = subPathIndex + 1; i < path.elementCount()
i < path.elementCount()Description
TRUEnever evaluated
FALSEnever evaluated
&& (!elements
!elementsDescription
TRUEnever evaluated
FALSEnever evaluated
|| elements[i] != QPainterPath::MoveToElement
elements[i] !=...:MoveToElementDescription
TRUEnever evaluated
FALSEnever evaluated
); ++i) {
0
37 sum += points[i];-
38 ++count;-
39 }
never executed: end of block
0
40-
41 const QPointF centroid = sum / qreal(count);-
42 vertexArray.add(centroid);-
43}
never executed: end of block
0
44-
45void QOpenGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline)-
46{-
47 const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());-
48 const QPainterPath::ElementType* const elements = path.elements();-
49-
50 if (boundingRectDirty
boundingRectDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
51 minX = maxX = points[0].x();-
52 minY = maxY = points[0].y();-
53 boundingRectDirty = false;-
54 }
never executed: end of block
0
55-
56 if (!outline
!outlineDescription
TRUEnever evaluated
FALSEnever evaluated
&& !path.isConvex()
!path.isConvex()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
57 addCentroid(path, 0);
never executed: addCentroid(path, 0);
0
58-
59 int lastMoveTo = vertexArray.size();-
60 vertexArray.add(points[0]);-
61-
62 do {-
63 if (!elements
!elementsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
64-
65-
66-
67 for (int i=1; i<path.elementCount()
i<path.elementCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
68 lineToArray(points[i].x(), points[i].y());
never executed: lineToArray(points[i].x(), points[i].y());
0
69-
70 break;
never executed: break;
0
71 }-
72-
73-
74 for (int i=1; i<path.elementCount()
i<path.elementCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
75 switch (elements[i]) {-
76 case
never executed: case QPainterPath::MoveToElement:
QPainterPath::MoveToElement:
never executed: case QPainterPath::MoveToElement:
0
77 if (!outline
!outlineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
78 addClosingLine(lastMoveTo);
never executed: addClosingLine(lastMoveTo);
0
79-
80 vertexArrayStops.add(vertexArray.size());-
81 if (!outline
!outlineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
82 if (!path.isConvex()
!path.isConvex()Description
TRUEnever evaluated
FALSEnever evaluated
) addCentroid(path, i);
never executed: addCentroid(path, i);
0
83 lastMoveTo = vertexArray.size();-
84 }
never executed: end of block
0
85 lineToArray(points[i].x(), points[i].y());-
86 break;
never executed: break;
0
87 case
never executed: case QPainterPath::LineToElement:
QPainterPath::LineToElement:
never executed: case QPainterPath::LineToElement:
0
88-
89 lineToArray(points[i].x(), points[i].y());-
90 break;
never executed: break;
0
91 case
never executed: case QPainterPath::CurveToElement:
QPainterPath::CurveToElement:
never executed: case QPainterPath::CurveToElement:
{
0
92 QBezier b = QBezier::fromPoints(*(((const QPointF *) points) + i - 1),-
93 points[i],-
94 points[i+1],-
95 points[i+2]);-
96 QRectF bounds = b.bounds();-
97-
98 int threshold = qMin<float>(64, qMax(bounds.width(), bounds.height()) * 3.14f / (curveInverseScale * 6));-
99 if (threshold < 3
threshold < 3Description
TRUEnever evaluated
FALSEnever evaluated
) threshold = 3;
never executed: threshold = 3;
0
100 qreal one_over_threshold_minus_1 = qreal(1) / (threshold - 1);-
101 for (int t=0; t<threshold
t<thresholdDescription
TRUEnever evaluated
FALSEnever evaluated
; ++t) {
0
102 QPointF pt = b.pointAt(t * one_over_threshold_minus_1);-
103 lineToArray(pt.x(), pt.y());-
104 }
never executed: end of block
0
105 i += 2;-
106 break;
never executed: break;
}
0
107 default
never executed: default:
:
never executed: default:
0
108 break;
never executed: break;
0
109 }-
110 }-
111 } while (0);-
112-
113 if (!outline
!outlineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
114 addClosingLine(lastMoveTo);
never executed: addClosingLine(lastMoveTo);
0
115 vertexArrayStops.add(vertexArray.size());-
116}
never executed: end of block
0
117-
118void QOpenGL2PEXVertexArray::lineToArray(const GLfloat x, const GLfloat y)-
119{-
120 vertexArray.add(QOpenGLPoint(x, y));-
121-
122 if (x > maxX
x > maxXDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
123 maxX = x;
never executed: maxX = x;
0
124 else if (x < minX
x < minXDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
125 minX = x;
never executed: minX = x;
0
126 if (y > maxY
y > maxYDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
127 maxY = y;
never executed: maxY = y;
0
128 else if (y < minY
y < minYDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
129 minY = y;
never executed: minY = y;
0
130}
never executed: end of block
0
131-
132-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9