diff layer/PaintAssistant.h @ 1228:dc6457ac4d07

Add method to scale pen widths for hi-res screens
author Chris Cannam
date Thu, 26 Jan 2017 21:17:19 +0000
parents ee01a4062747
children a34a2a25907c
line wrap: on
line diff
--- a/layer/PaintAssistant.h	Thu Jan 26 21:16:46 2017 +0000
+++ b/layer/PaintAssistant.h	Thu Jan 26 21:17:19 2017 +0000
@@ -13,10 +13,11 @@
     COPYING included with this distribution for more information.
 */
 
-#ifndef PAINT_ASSISTANT_H
-#define PAINT_ASSISTANT_H
+#ifndef SV_PAINT_ASSISTANT_H
+#define SV_PAINT_ASSISTANT_H
 
 #include <QRect>
+#include <QPen>
 #include <vector>
 
 class QPainter;
@@ -46,6 +47,18 @@
     static void drawVisibleText(const LayerGeometryProvider *,
                                 QPainter &p, int x, int y,
                                 QString text, TextStyle style);
+
+    /**
+     * Scale up pen width for a hi-dpi display without pixel doubling.
+     * Very similar to ViewManager::scalePixelSize, but a bit more
+     * conservative.
+     */
+    static double scalePenWidth(double width);
+
+    /**
+     * Apply scalePenWidth to a pen.
+     */
+    static QPen scalePen(QPen pen);
 };
 
 #endif