From 56b2b505cd2067963775b0b2a7ec68fdbfe5ea36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 19 Apr 2018 16:42:03 +0200 Subject: [PATCH] [escher] Avoid using floats to compute ints. Change-Id: I5637194badc75eec6f016f44bb9660b51d2157b9 --- escher/src/expression_view.cpp | 2 +- escher/src/stack_view.cpp | 2 +- escher/src/tab_view_cell.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/escher/src/expression_view.cpp b/escher/src/expression_view.cpp index dfd23e3b3..a760f635a 100644 --- a/escher/src/expression_view.cpp +++ b/escher/src/expression_view.cpp @@ -49,7 +49,7 @@ KDSize ExpressionView::minimalSizeForOptimalDisplay() const { KDPoint ExpressionView::drawingOrigin() const { KDSize expressionSize = m_expressionLayout->size(); - return KDPoint(m_horizontalAlignment*(m_frame.width() - expressionSize.width()), 0.5f*(m_frame.height() - expressionSize.height())); + return KDPoint(m_horizontalAlignment*(m_frame.width() - expressionSize.width()), (m_frame.height() - expressionSize.height())/2); } KDPoint ExpressionView::absoluteDrawingOrigin() const { diff --git a/escher/src/stack_view.cpp b/escher/src/stack_view.cpp index 5f125bea5..bd667671d 100644 --- a/escher/src/stack_view.cpp +++ b/escher/src/stack_view.cpp @@ -37,7 +37,7 @@ void StackView::drawRect(KDContext * ctx, KDRect rect) const { ctx->fillRect(KDRect(0, height-1, width, 1), m_separatorColor); // Write title KDSize textSize = KDText::stringSize(m_controller->title(), KDText::FontSize::Small); - KDPoint origin(0.5f*(m_frame.width() - textSize.width()),0.5f*(m_frame.height() - textSize.height())); + KDPoint origin((m_frame.width() - textSize.width())/2,(m_frame.height() - textSize.height())/2); ctx->drawString(m_controller->title(), origin, KDText::FontSize::Small, m_textColor, m_backgroundColor); } diff --git a/escher/src/tab_view_cell.cpp b/escher/src/tab_view_cell.cpp index 7bea92c38..43be0c1c8 100644 --- a/escher/src/tab_view_cell.cpp +++ b/escher/src/tab_view_cell.cpp @@ -48,7 +48,7 @@ void TabViewCell::drawRect(KDContext * ctx, KDRect rect) const { } // Write title KDSize textSize = KDText::stringSize(m_controller->title(), KDText::FontSize::Small); - KDPoint origin(0.5f*(m_frame.width() - textSize.width()),0.5f*(m_frame.height() - textSize.height())); + KDPoint origin((m_frame.width() - textSize.width())/2, (m_frame.height() - textSize.height())/2); ctx->drawString(m_controller->title(), origin, KDText::FontSize::Small, text, background); }