Mercurial > hg > svgui
diff layer/PaintAssistant.cpp @ 1401:28075cc658c9
Scale pen for retina display on macOS as well as for hidpi display elsewhere
author | Chris Cannam |
---|---|
date | Thu, 15 Nov 2018 14:04:32 +0000 |
parents | cca66ce390e0 |
children | f2525e6cbdf1 |
line wrap: on
line diff
--- a/layer/PaintAssistant.cpp Thu Nov 15 13:06:38 2018 +0000 +++ b/layer/PaintAssistant.cpp Thu Nov 15 14:04:32 2018 +0000 @@ -241,48 +241,4 @@ } } -double -PaintAssistant::scaleSize(double size) -{ - static double ratio = 0.0; - if (ratio == 0.0) { - double baseEm; -#ifdef Q_OS_MAC - baseEm = 17.0; -#else - baseEm = 15.0; -#endif - double em = QFontMetrics(QFont()).height(); - ratio = em / baseEm; - 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; - } - } - - return size * ratio; -} - -double -PaintAssistant::scalePenWidth(double width) -{ - if (width <= 0) { - // zero-width pen, produce a scaled one-pixel pen - width = 1; - } - - return scaleSize(width); -} - -QPen -PaintAssistant::scalePen(QPen pen) -{ - return QPen(pen.color(), scalePenWidth(pen.width())); -} - -