diff options
author | B. Stack <bgstack15@gmail.com> | 2021-04-05 15:59:11 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-04-05 15:59:11 +0000 |
commit | 8d28254d708c88ae4aaebbc82cbb6c91726aa390 (patch) | |
tree | dafb5e266c513a5ed9863401e62d246742861e0c /wx+/dc.h | |
parent | Merge branch '11.7' into 'master' (diff) | |
parent | add upstream 11.9 (diff) | |
download | FreeFileSync-8d28254d708c88ae4aaebbc82cbb6c91726aa390.tar.gz FreeFileSync-8d28254d708c88ae4aaebbc82cbb6c91726aa390.tar.bz2 FreeFileSync-8d28254d708c88ae4aaebbc82cbb6c91726aa390.zip |
Merge branch '11.9' into 'master'11.9
add upstream 11.9
See merge request opensource-tracking/FreeFileSync!32
Diffstat (limited to 'wx+/dc.h')
-rw-r--r-- | wx+/dc.h | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -64,9 +64,10 @@ void drawFilledRectangle(wxDC& dc, wxRect rect, int borderWidth, const wxColor& /* Standard DPI: Windows/Ubuntu: 96 x 96 macOS: wxWidgets uses DIP (note: wxScreenDC().GetPPI() returns 72 x 72 which is a lie; looks like 96 x 96) */ +constexpr int defaultDpi = 96; inline -int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and buffered) +int getDPI() { #ifndef wxHAVE_DPI_INDEPENDENT_PIXELS #error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined? @@ -75,11 +76,24 @@ int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and //=> requires general fix at wxWidgets-level //https://github.com/wxWidgets/wxWidgets/blob/d9d05c2bb201078f5e762c42458ca2f74af5b322/include/wx/window.h#L2060 - return d; //e.g. macOS, GTK3 + return defaultDpi; //e.g. macOS, GTK3 +} + + +inline +int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and buffered) +{ + return numeric::intDivRound(d * getDPI() - 10 /*round values like 1.5 down => 1 pixel on 150% scale*/, defaultDpi); } int fastFromDIP(double d) = delete; +inline +int getDpiScalePercent() +{ + return numeric::intDivRound(100 * getDPI(), defaultDpi); +} + //---------------------- implementation ------------------------ class RecursiveDcClipper |