diff layer/PaintAssistant.cpp @ 1373:cca66ce390e0

Scaling tweaks
author Chris Cannam
date Mon, 05 Nov 2018 13:30:21 +0000
parents 6e35062fc10a
children 28075cc658c9
line wrap: on
line diff
--- a/layer/PaintAssistant.cpp	Fri Nov 02 15:23:53 2018 +0000
+++ b/layer/PaintAssistant.cpp	Mon Nov 05 13:30:21 2018 +0000
@@ -242,7 +242,7 @@
 }
 
 double
-PaintAssistant::scalePenWidth(double width)
+PaintAssistant::scaleSize(double size)
 {
     static double ratio = 0.0;
     if (ratio == 0.0) {
@@ -255,21 +255,28 @@
         double em = QFontMetrics(QFont()).height();
         ratio = em / baseEm;
 
-        SVDEBUG << "PaintAssistant::scalePenWidth: ratio is " << ratio
+        SVDEBUG << "PaintAssistant::scaleSize: ratio is " << ratio
                 << " (em = " << em << ")" << endl;
+
+        if (ratio < 1.0) {
+            SVDEBUG << "PaintAssistant::scaleSize: rounding ratio up to 1.0"
+                    << endl;
+            ratio = 1.0;
+        }
     }
 
-    if (ratio <= 1.0) {
-        // we only ever scale up in this method
-        return width;
+    return size * ratio;
+}
+
+double
+PaintAssistant::scalePenWidth(double width)
+{
+    if (width <= 0) {
+        // zero-width pen, produce a scaled one-pixel pen
+        width = 1;
     }
 
-    if (width <= 0) {
-        // zero-width pen, produce a scaled one-pixel pen
-        return ratio;
-    }
-
-    return width * ratio;
+    return scaleSize(width);
 }
 
 QPen