| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopengl2pexvertexarray.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | void QOpenGL2PEXVertexArray::clear() | - | ||||||||||||||||||
| 6 | { | - | ||||||||||||||||||
| 7 | vertexArray.reset(); | - | ||||||||||||||||||
| 8 | vertexArrayStops.reset(); | - | ||||||||||||||||||
| 9 | boundingRectDirty = true; | - | ||||||||||||||||||
| 10 | } never executed:  end of block | 0 | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | - | |||||||||||||||||||
| 13 | QOpenGLRect QOpenGL2PEXVertexArray::boundingRect() const | - | ||||||||||||||||||
| 14 | { | - | ||||||||||||||||||
| 15 |     if (boundingRectDirty
  | 0 | ||||||||||||||||||
| 16 |         return never executed:   QOpenGLRect(0.0, 0.0, 0.0, 0.0);return 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:   QOpenGLRect(minX, minY, maxX, maxY);return QOpenGLRect(minX, minY, maxX, maxY);never executed:  return QOpenGLRect(minX, minY, maxX, maxY); | 0 | ||||||||||||||||||
| 19 | } | - | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | void QOpenGL2PEXVertexArray::addClosingLine(int index) | - | ||||||||||||||||||
| 22 | { | - | ||||||||||||||||||
| 23 | QPointF point(vertexArray.at(index)); | - | ||||||||||||||||||
| 24 |     if (point != QPointF(vertexArray.last())
  | 0 | ||||||||||||||||||
| 25 |         vertexArray.add(point); never executed:  vertexArray.add(point); | 0 | ||||||||||||||||||
| 26 | } never executed:  end of block | 0 | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | void 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()
 
 
  | 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 | - | |||||||||||||||||||
| 45 | void 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
  | 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
 
  | 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
  | 0 | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 |             for (int i=1; i<path.elementCount()
  | 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()
  | 0 | ||||||||||||||||||
| 75 | switch (elements[i]) { | - | ||||||||||||||||||
| 76 |             case never executed:   QPainterPath::MoveToElement:case QPainterPath::MoveToElement:never executed:  case QPainterPath::MoveToElement: | 0 | ||||||||||||||||||
| 77 |                 if (!outline
  | 0 | ||||||||||||||||||
| 78 |                     addClosingLine(lastMoveTo); never executed:  addClosingLine(lastMoveTo); | 0 | ||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | vertexArrayStops.add(vertexArray.size()); | - | ||||||||||||||||||
| 81 |                 if (!outline
  | 0 | ||||||||||||||||||
| 82 |                     if (!path.isConvex()
 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:   QPainterPath::LineToElement:case 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:   QPainterPath::CurveToElement:case 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
 never executed:  threshold = 3; | 0 | ||||||||||||||||||
| 100 | qreal one_over_threshold_minus_1 = qreal(1) / (threshold - 1); | - | ||||||||||||||||||
| 101 |                 for (int t=0; t<threshold
  | 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
  | 0 | ||||||||||||||||||
| 114 |         addClosingLine(lastMoveTo); never executed:  addClosingLine(lastMoveTo); | 0 | ||||||||||||||||||
| 115 | vertexArrayStops.add(vertexArray.size()); | - | ||||||||||||||||||
| 116 | } never executed:  end of block | 0 | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | void QOpenGL2PEXVertexArray::lineToArray(const GLfloat x, const GLfloat y) | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | vertexArray.add(QOpenGLPoint(x, y)); | - | ||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 |     if (x > maxX
  | 0 | ||||||||||||||||||
| 123 |         maxX = x; never executed:  maxX = x; | 0 | ||||||||||||||||||
| 124 |     else if (x < minX
  | 0 | ||||||||||||||||||
| 125 |         minX = x; never executed:  minX = x; | 0 | ||||||||||||||||||
| 126 |     if (y > maxY
  | 0 | ||||||||||||||||||
| 127 |         maxY = y; never executed:  maxY = y; | 0 | ||||||||||||||||||
| 128 |     else if (y < minY
  | 0 | ||||||||||||||||||
| 129 |         minY = y; never executed:  minY = y; | 0 | ||||||||||||||||||
| 130 | } never executed:  end of block | 0 | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |