| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickclipnode.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | QQuickDefaultClipNode::QQuickDefaultClipNode(const QRectF &rect) | - | ||||||
| 4 | : m_rect(rect) | - | ||||||
| 5 | , m_radius(0) | - | ||||||
| 6 | , m_dirty_geometry(true) | - | ||||||
| 7 | , m_geometry(QSGGeometry::defaultAttributes_Point2D(), 0) | - | ||||||
| 8 | { | - | ||||||
| 9 | (void)m_reserved;; | - | ||||||
| 10 | setGeometry(&m_geometry); | - | ||||||
| 11 | setIsRectangular(true); | - | ||||||
| 12 | } executed 386 times by 9 tests: end of blockExecuted by:
| 386 | ||||||
| 13 | - | |||||||
| 14 | void QQuickDefaultClipNode::setRect(const QRectF &rect) | - | ||||||
| 15 | { | - | ||||||
| 16 | m_rect = rect; | - | ||||||
| 17 | m_dirty_geometry = true; | - | ||||||
| 18 | } executed 330 times by 9 tests: end of blockExecuted by:
| 330 | ||||||
| 19 | - | |||||||
| 20 | void QQuickDefaultClipNode::setRadius(qreal radius) | - | ||||||
| 21 | { | - | ||||||
| 22 | m_radius = radius; | - | ||||||
| 23 | m_dirty_geometry = true; | - | ||||||
| 24 | setIsRectangular(radius == 0); | - | ||||||
| 25 | } never executed: end of block | 0 | ||||||
| 26 | - | |||||||
| 27 | void QQuickDefaultClipNode::update() | - | ||||||
| 28 | { | - | ||||||
| 29 | if (m_dirty_geometry
| 0-592 | ||||||
| 30 | updateGeometry(); | - | ||||||
| 31 | m_dirty_geometry = false; | - | ||||||
| 32 | } executed 592 times by 9 tests: end of blockExecuted by:
| 592 | ||||||
| 33 | } executed 592 times by 9 tests: end of blockExecuted by:
| 592 | ||||||
| 34 | - | |||||||
| 35 | void QQuickDefaultClipNode::updateGeometry() | - | ||||||
| 36 | { | - | ||||||
| 37 | QSGGeometry *g = geometry(); | - | ||||||
| 38 | - | |||||||
| 39 | if (qFuzzyIsNull(m_radius)
| 0-592 | ||||||
| 40 | g->allocate(4); | - | ||||||
| 41 | QSGGeometry::updateRectGeometry(g, m_rect); | - | ||||||
| 42 | - | |||||||
| 43 | } executed 592 times by 9 tests: else {end of blockExecuted by:
| 592 | ||||||
| 44 | int vertexCount = 0; | - | ||||||
| 45 | - | |||||||
| 46 | - | |||||||
| 47 | qreal radius = qMin(qMin(m_rect.width() / 2, m_rect.height() / 2), m_radius); | - | ||||||
| 48 | QRectF rect = m_rect; | - | ||||||
| 49 | rect.adjust(radius, radius, -radius, -radius); | - | ||||||
| 50 | - | |||||||
| 51 | int segments = qMin(30, qCeil(radius)); | - | ||||||
| 52 | - | |||||||
| 53 | g->allocate((segments + 1) * 4); | - | ||||||
| 54 | - | |||||||
| 55 | QVector2D *vertices = (QVector2D *)g->vertexData(); | - | ||||||
| 56 | - | |||||||
| 57 | for (int part = 0; part < 2
| 0 | ||||||
| 58 | for (int i = 0; i <= segments
| 0 | ||||||
| 59 | - | |||||||
| 60 | qreal angle = qreal(0.5 * | - | ||||||
| 61 | 3.14159265358979323846 | - | ||||||
| 62 | ) * (part + i / qreal(segments)); | - | ||||||
| 63 | qreal s = qFastSin(angle); | - | ||||||
| 64 | qreal c = qFastCos(angle); | - | ||||||
| 65 | qreal y = (part
| 0 | ||||||
| 66 | qreal lx = rect.left() - radius * s; | - | ||||||
| 67 | qreal rx = rect.right() + radius * s; | - | ||||||
| 68 | - | |||||||
| 69 | vertices[vertexCount++] = QVector2D(rx, y); | - | ||||||
| 70 | vertices[vertexCount++] = QVector2D(lx, y); | - | ||||||
| 71 | } never executed: end of block | 0 | ||||||
| 72 | } never executed: end of block | 0 | ||||||
| 73 | - | |||||||
| 74 | } never executed: end of block | 0 | ||||||
| 75 | setClipRect(m_rect); | - | ||||||
| 76 | markDirty(DirtyGeometry); | - | ||||||
| 77 | } executed 592 times by 9 tests: end of blockExecuted by:
| 592 | ||||||
| Switch to Source code | Preprocessed file |