summaryrefslogtreecommitdiff
path: root/wx+/dc.h
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-04-18 13:48:31 +0000
committerB. Stack <bgstack15@gmail.com>2022-04-18 13:48:31 +0000
commit8a551d2eff24bdd23bc25caeb8d17207409aae38 (patch)
tree84e67ca0a1fb045a12d015fcffca9cd8087c9332 /wx+/dc.h
parentMerge branch 'b11.18' into 'master' (diff)
parentadd upstream 11.20 (diff)
downloadFreeFileSync-8a551d2eff24bdd23bc25caeb8d17207409aae38.tar.gz
FreeFileSync-8a551d2eff24bdd23bc25caeb8d17207409aae38.tar.bz2
FreeFileSync-8a551d2eff24bdd23bc25caeb8d17207409aae38.zip
Merge branch 'b11.20' into 'master'11.20
add upstream 11.20 See merge request opensource-tracking/FreeFileSync!43
Diffstat (limited to 'wx+/dc.h')
-rw-r--r--wx+/dc.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/wx+/dc.h b/wx+/dc.h
index c5b78119..d303de4c 100644
--- a/wx+/dc.h
+++ b/wx+/dc.h
@@ -12,6 +12,7 @@
#include <zen/basic_math.h>
#include <wx/dcbuffer.h> //for macro: wxALWAYS_NATIVE_DOUBLE_BUFFER
#include <wx/dcscreen.h>
+#include <wx/bmpbndl.h>
#include <gtk/gtk.h>
@@ -91,8 +92,8 @@ constexpr int defaultDpi = 96;
inline
int getDPI()
{
-#ifndef wxHAVE_DPI_INDEPENDENT_PIXELS
-#error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined?
+#ifndef wxHAS_DPI_INDEPENDENT_PIXELS
+#error why is wxHAS_DPI_INDEPENDENT_PIXELS not defined?
#endif
//GTK2 doesn't properly support high DPI: https://freefilesync.org/forum/viewtopic.php?t=6114
//=> requires general fix at wxWidgets-level
@@ -117,6 +118,16 @@ int getDpiScalePercent()
}
+inline
+wxBitmapBundle toBitmapBundle(const wxImage& img /*expected to be DPI-scaled!*/)
+{
+ //return wxBitmap(img, -1 /*depth*/, static_cast<double>(getDPI()) / defaultDpi); not (yet) implemented
+ wxBitmap bmpScaled(img);
+ bmpScaled.SetScaleFactor(static_cast<double>(getDPI()) / defaultDpi);
+ return bmpScaled;
+}
+
+
//---------------------- implementation ------------------------
class RecursiveDcClipper
{
bgstack15