Mercurial > hg > svgui
diff layer/PaintAssistant.cpp @ 1374:631897ba9fca zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 06 Nov 2018 08:59:03 +0000 |
parents | cca66ce390e0 |
children | 28075cc658c9 |
line wrap: on
line diff
--- a/layer/PaintAssistant.cpp Fri Oct 05 10:25:52 2018 +0100 +++ b/layer/PaintAssistant.cpp Tue Nov 06 08:59:03 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