diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-12 10:00:31 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-12 13:52:08 +0000 |
commit | 424cfef3cc3c140df51905713fa3849562bc494d (patch) | |
tree | e11680027eb11cc38769eb572161f86dc3164380 /src/quick/scenegraph/adaptations/software | |
parent | b98af3e0f3bfdc0187d7955683f90a7012a2d133 (diff) |
Quick: Use devicePixelRatioF rather than devicePixelRatio
The integer version of devicePixelRatio cannot handle fractional ratios
and will lead to arithmetic exceptions for ratios between 0 and 1.
Change-Id: I4a06a12742fa85e6d2f0e24193ae796dec7e2f15
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/quick/scenegraph/adaptations/software')
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwareglyphnode.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareglyphnode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareglyphnode.cpp index 21f20c66cd..7ab9c15d9b 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareglyphnode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareglyphnode.cpp @@ -91,8 +91,8 @@ void QSGSoftwareGlyphNode::paint(QPainter *painter) QPointF pos = m_position - QPointF(0, m_glyphRun.rawFont().ascent()); qreal offset = 1.0; - if (painter->device()->devicePixelRatio() != 0) - offset = 1.0 / painter->device()->devicePixelRatio(); + if (painter->device()->devicePixelRatioF() > 0.0) + offset = 1.0 / painter->device()->devicePixelRatioF(); switch (m_style) { case QQuickText::Normal: break; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp index ffcee5f56e..e9ed52d428 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp @@ -113,8 +113,8 @@ void QSGSoftwareRenderer::render() setBackgroundColor(clearColor()); setBackgroundRect(QRect(0, 0, - m_paintDevice->width() / m_paintDevice->devicePixelRatio(), - m_paintDevice->height() / m_paintDevice->devicePixelRatio())); + m_paintDevice->width() / m_paintDevice->devicePixelRatioF(), + m_paintDevice->height() / m_paintDevice->devicePixelRatioF())); // Build Renderlist // The renderlist is created by visiting each node in the tree and when a |