src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    57 {
    57 {
    58     if (boundingRectDirty)
    58     if (boundingRectDirty)
    59         return QGLRect(0.0, 0.0, 0.0, 0.0);
    59         return QGLRect(0.0, 0.0, 0.0, 0.0);
    60     else
    60     else
    61         return QGLRect(minX, minY, maxX, maxY);
    61         return QGLRect(minX, minY, maxX, maxY);
    62 }
       
    63 
       
    64 void QGL2PEXVertexArray::addRect(const QRectF &rect)
       
    65 {
       
    66     vertexArray << rect.topLeft() << rect.topRight() << rect.bottomRight()
       
    67                 << rect.bottomRight() << rect.bottomLeft() << rect.topLeft();
       
    68 }
    62 }
    69 
    63 
    70 void QGL2PEXVertexArray::addClosingLine(int index)
    64 void QGL2PEXVertexArray::addClosingLine(int index)
    71 {
    65 {
    72     if (QPointF(vertexArray.at(index)) != QPointF(vertexArray.last()))
    66     if (QPointF(vertexArray.at(index)) != QPointF(vertexArray.last()))
   143                                                 points[i+2]);
   137                                                 points[i+2]);
   144                 QRectF bounds = b.bounds();
   138                 QRectF bounds = b.bounds();
   145                 // threshold based on same algorithm as in qtriangulatingstroker.cpp
   139                 // threshold based on same algorithm as in qtriangulatingstroker.cpp
   146                 int threshold = qMin<float>(64, qMax(bounds.width(), bounds.height()) * 3.14f / (curveInverseScale * 6));
   140                 int threshold = qMin<float>(64, qMax(bounds.width(), bounds.height()) * 3.14f / (curveInverseScale * 6));
   147                 if (threshold < 3) threshold = 3;
   141                 if (threshold < 3) threshold = 3;
   148                 qreal one_over_threshold_minus_1 = 1.f / (threshold - 1);
   142                 qreal one_over_threshold_minus_1 = qreal(1) / (threshold - 1);
   149                 for (int t=0; t<threshold; ++t) {
   143                 for (int t=0; t<threshold; ++t) {
   150                     QPointF pt = b.pointAt(t * one_over_threshold_minus_1);
   144                     QPointF pt = b.pointAt(t * one_over_threshold_minus_1);
   151                     lineToArray(pt.x(), pt.y());
   145                     lineToArray(pt.x(), pt.y());
   152                 }
   146                 }
   153                 i += 2;
   147                 i += 2;