summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-11-25 12:09:54 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-11-25 12:09:54 +0100
commit4f894e4745280958e1e4a08f4e49bd94abb5ea36 (patch)
tree601ccf06444641e8be938186a014c912e4dd6344 /src/drivers/Wayland
parent0beab855a053275b41368d3f32cddd2d6389ca2c (diff)
Cairo graphics driver: Improve drawing of Fl_Pixmap and Fl_Bitmap
Previously, these objects were drawn slightly blurred on HighDPI. This commit has them resized to the pixel size of the area where they are being drawn and then drawn.
Diffstat (limited to 'src/drivers/Wayland')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H1
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx7
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx1
3 files changed, 9 insertions, 0 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
index b757a8a6e..8578bc59a 100644
--- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
@@ -56,6 +56,7 @@ public:
static struct wl_shm_pool *current_pool;
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc,
int srcx, int srcy) FL_OVERRIDE;
+ void cache_size(Fl_Image *img, int &width, int &height) FL_OVERRIDE;
static struct wld_buffer *create_wld_buffer(int width, int height, bool with_shm = true);
static void create_shm_buffer(wld_buffer *buffer);
static void buffer_release(struct wld_window *window);
diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
index 34e4971da..b2def3703 100644
--- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
@@ -287,3 +287,10 @@ Fl_Image_Surface *Fl_Wayland_Graphics_Driver::custom_offscreen(int w, int h,
cairo_set_user_data(off->draw_buffer.cairo_, &key, &off->draw_buffer, NULL);
return new Fl_Image_Surface(w, h, 0, (Fl_Offscreen)off->draw_buffer.cairo_);
}
+
+
+void Fl_Wayland_Graphics_Driver::cache_size(Fl_Image *img, int &width, int &height) {
+ Fl_Graphics_Driver::cache_size(img, width, height);
+ width *= wld_scale;
+ height *= wld_scale;
+}
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 0b228d83a..83865878a 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -370,6 +370,7 @@ void Fl_Wayland_Window_Driver::make_current() {
}
((Fl_Wayland_Graphics_Driver*)fl_graphics_driver)->set_cairo(
window->buffer->draw_buffer.cairo_, f * wld_s);
+ ((Fl_Cairo_Graphics_Driver*)fl_graphics_driver)->wld_scale = wld_s;
int *poffset = Fl_Window_Driver::menu_offset_y(pWindow);
if (poffset) { // for tall menu windows under KWIN to offset drawing inside window
cairo_translate(window->buffer->draw_buffer.cairo_, 0, *poffset);