freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master 44b2391 08/13: [ftinspect] Replace old-style ca


From: Werner LEMBERG
Subject: [freetype2-demos] master 44b2391 08/13: [ftinspect] Replace old-style casts with C++ casts.
Date: Thu, 11 May 2017 15:26:23 -0400 (EDT)

branch: master
commit 44b2391f57952216870dab6d9ed4f2e4bcc5a621
Author: Philipp Kerling <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftinspect] Replace old-style casts with C++ casts.
    
    * src/ftinspect.cpp (Engine::update, GlyphPointNumbers::paint): Do
    it.
---
 ChangeLog         |  7 +++++++
 src/ftinspect.cpp | 26 ++++++++++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d4a36b5..934b53e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2017-05-11  Philipp Kerling  <address@hidden>
 
+       [ftinspect] Replace old-style casts with C++ casts.
+
+       * src/ftinspect.cpp (Engine::update, GlyphPointNumbers::paint): Do
+       it.
+
+2017-05-11  Philipp Kerling  <address@hidden>
+
        [ftinspect] Make color tables and settings more readable.
 
        * src/ftinspect.cpp (MainGUI::setGraphicsDefaults): Use Qt
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index cf7dc72..bab5d4c 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -621,15 +621,15 @@ Engine::update()
 
   if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px)
   {
-    scaler.width = int(pixelSize * 64.0);
-    scaler.height = int(pixelSize * 64.0);
+    scaler.width = static_cast<unsigned int>(pixelSize * 64.0);
+    scaler.height = static_cast<unsigned int>(pixelSize * 64.0);
     scaler.x_res = 0;
     scaler.y_res = 0;
   }
   else
   {
-    scaler.width = int(pointSize * 64.0);
-    scaler.height = int(pointSize * 64.0);
+    scaler.width = static_cast<unsigned int>(pointSize * 64.0);
+    scaler.height = static_cast<unsigned int>(pointSize * 64.0);
     scaler.x_res = dpi;
     scaler.y_res = dpi;
   }
@@ -1057,10 +1057,14 @@ GlyphPointNumbers::paint(QPainter* painter,
         }
 
         // get vectors to previous and next point and normalize them;
-        QVector2D in(qreal(points[prevIdx].x - points[ptIdx].x) / 64,
-                     -qreal(points[prevIdx].y - points[ptIdx].y) / 64);
-        QVector2D out(qreal(points[nextIdx].x - points[ptIdx].x) / 64,
-                      -qreal(points[nextIdx].y - points[ptIdx].y) / 64);
+        QVector2D in(static_cast<float>(points[prevIdx].x
+                                        - points[ptIdx].x) / 64,
+                     -static_cast<float>(points[prevIdx].y
+                                         - points[ptIdx].y) / 64);
+        QVector2D out(static_cast<float>(points[nextIdx].x
+                                         - points[ptIdx].x) / 64,
+                      -static_cast<float>(points[nextIdx].y
+                                          - points[ptIdx].y) / 64);
 
         in = in.normalized();
         out = out.normalized();
@@ -1117,8 +1121,10 @@ GlyphPointNumbers::paint(QPainter* painter,
         path.addText(QPointF(0, 0), font, number);
         QRectF ctrlPtRect = path.controlPointRect();
 
-        qreal x = qreal(points[ptIdx].x) / 64 * lod - middle.x();
-        qreal y = -qreal(points[ptIdx].y) / 64 * lod - middle.y();
+        qreal x = static_cast<qreal>(points[ptIdx].x) / 64 * lod
+                  - static_cast<qreal>(middle.x());
+        qreal y = -static_cast<qreal>(points[ptIdx].y) / 64 * lod
+                  - static_cast<qreal>(middle.y());
 
         qreal heuristicOffset = 2;
         if (middle.x() > 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]