diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-02-09 07:52:20 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-02-09 07:52:20 +0100 |
| commit | d6aa3a67a0fba50869e9b65b5fb6e171e43e5d1b (patch) | |
| tree | ddf1c162a8d948c290154a5f19e337bea53b4623 | |
| parent | 83bd04e0a32c42923d1a2dbcada02e0542b78044 (diff) | |
Add screen scaling support to Fl_Cairo_Window under X11 platform.
| -rw-r--r-- | cairo/Fl_Cairo.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cairo/Fl_Cairo.cxx b/cairo/Fl_Cairo.cxx index 41a4e4b6d..de70d33df 100644 --- a/cairo/Fl_Cairo.cxx +++ b/cairo/Fl_Cairo.cxx @@ -84,11 +84,20 @@ cairo_t * Fl::cairo_make_current(Fl_Window* wi) { cairo_state_.window(wi); + cairo_t * cairo_ctxt; +#ifndef __APPLE__ + float scale = Fl::screen_scale(wi->screen_num()); // get the screen scaling factor +#endif #if defined(USE_X11) - return Fl::cairo_make_current(0, wi->w(), wi->h()); + cairo_ctxt = Fl::cairo_make_current(0, wi->w() * scale, wi->h() * scale); #else - return Fl::cairo_make_current(fl_gc, wi->w(), wi->h()); + // on macOS, scaling is done before by Fl_Window::make_current(), on Windows, the size is not used + cairo_ctxt = Fl::cairo_make_current(fl_gc, wi->w(), wi->h()); +#endif +#ifndef __APPLE__ + cairo_scale(cairo_ctxt, scale, scale); #endif + return cairo_ctxt; } /* |
