| 339 | } |
| 340 | |
| 341 | void QuickDecorationsDrawer::drawGrid() |
| 342 | { |
| 343 | const QRectF &viewRect(m_renderInfo->viewRect); |
| 344 | const QPointF &gridOffset(m_renderInfo->settings.gridOffset); |
| 345 | const QSizeF &gridCellSize(m_renderInfo->settings.gridCellSize); |
| 346 | |
| 347 | if (!m_renderInfo->settings.gridEnabled || gridCellSize.isEmpty()) |
| 348 | return; |
| 349 | |
| 350 | m_painter->save(); |
| 351 | m_painter->setPen(m_renderInfo->settings.gridColor); |
| 352 | |
| 353 | QVector<QLineF> lines; |
| 354 | lines.reserve((viewRect.width() / gridCellSize.width()) + (viewRect.height() / gridCellSize.height())); |
| 355 | |
| 356 | // NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter) |
| 357 | for (qreal x = viewRect.left() + gridOffset.x(); x < viewRect.right(); x += gridCellSize.width()) { |
| 358 | if (x < viewRect.left()) |
| 359 | continue; |
| 360 | |
| 361 | lines << QLineF(QPointF(x, viewRect.top()) * m_renderInfo->zoom, |
| 362 | QPointF(x, viewRect.bottom()) * m_renderInfo->zoom); |
| 363 | } |
| 364 | |
| 365 | // NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter) |
| 366 | for (qreal y = viewRect.top() + gridOffset.y(); y < viewRect.bottom(); y += gridCellSize.height()) { |
| 367 | if (y < viewRect.top()) |
| 368 | continue; |
| 369 | |
| 370 | lines << QLineF(QPointF(viewRect.left(), y) * m_renderInfo->zoom, |
| 371 | QPointF(viewRect.right(), y) * m_renderInfo->zoom); |
| 372 | } |
| 373 | |
| 374 | m_painter->drawLines(lines); |
| 375 | m_painter->restore(); |
| 376 | } |
| 377 | |
| 378 | void QuickDecorationsDrawer::drawArrow(const QPointF &first, const QPointF &second) |
| 379 | { |