Qt 4.8
Functions
qdeclarativepath.cpp File Reference
#include "private/qdeclarativepath_p.h"
#include "private/qdeclarativepath_p_p.h"
#include <QSet>
#include <QTime>
#include <private/qbezier_p.h>
#include <QtCore/qmath.h>
#include <QtCore/qnumeric.h>

Go to the source code of this file.

Functions

static QBezier nextBezier (const QPainterPath &path, int *from, qreal *bezLength)
 

Function Documentation

◆ nextBezier()

static QBezier nextBezier ( const QPainterPath path,
int *  from,
qreal bezLength 
)
inlinestatic

Definition at line 346 of file qdeclarativepath.cpp.

Referenced by QDeclarativePath::createPointCache().

347 {
348  const int lastElement = path.elementCount() - 1;
349  for (int i=*from; i <= lastElement; ++i) {
350  const QPainterPath::Element &e = path.elementAt(i);
351 
352  switch (e.type) {
354  break;
356  {
357  QLineF line(path.elementAt(i-1), e);
358  *bezLength = line.length();
359  QPointF a = path.elementAt(i-1);
360  QPointF delta = e - a;
361  *from = i+1;
362  return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);
363  }
365  {
366  QBezier b = QBezier::fromPoints(path.elementAt(i-1),
367  e,
368  path.elementAt(i+1),
369  path.elementAt(i+2));
370  *bezLength = b.length();
371  *from = i+3;
372  return b;
373  }
374  default:
375  break;
376  }
377  }
378  *from = lastElement;
379  *bezLength = 0;
380  return QBezier();
381 }
ElementType type
the type of element
Definition: qpainterpath.h:81
The QPainterPath::Element class specifies the position and type of a subpath.
Definition: qpainterpath.h:77
qreal length() const
Returns the length of the line.
Definition: qline.cpp:698
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
long ASN1_INTEGER_get ASN1_INTEGER * a
qreal length(qreal error=0.01) const
Definition: qbezier.cpp:529
const QPainterPath::Element & elementAt(int i) const
Returns the element at the given index in the painter path.
Definition: qpainterpath.h:402
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
static QBezier fromPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
Definition: qbezier.cpp:71
int elementCount() const
Returns the number of path elements in the painter path.
Definition: qpainterpath.h:397