Skip to content

Commit

Permalink
Fix: Drawing bugs on Windows at very large scales (fltk#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManoloFLTK committed Dec 2, 2024
1 parent 9a7f4bd commit 981aa8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/Fl_Graphics_Driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,6 @@ void Fl_Scalable_Graphics_Driver::draw_image_mono_unscaled(Fl_Draw_Image_Cb cb,
float Fl_Scalable_Graphics_Driver::override_scale() {
float s = scale();
if (s != 1.f) {
push_no_clip();
scale(1.f);
}
return s;
Expand All @@ -1208,7 +1207,6 @@ float Fl_Scalable_Graphics_Driver::override_scale() {
void Fl_Scalable_Graphics_Driver::restore_scale(float s) {
if (s != 1.f) {
scale(s);
pop_clip();
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1493,15 +1493,17 @@ char Fl_Cairo_Graphics_Driver::can_do_alpha_blending() {
float Fl_Cairo_Graphics_Driver::override_scale() {
float s = scale();
if (s != 1.f && Fl_Display_Device::display_device()->is_current()) {
scale(1);
cairo_scale(cairo_, 1./s, 1./s);
Fl_Graphics_Driver::scale(1);
}
return s;
}


void Fl_Cairo_Graphics_Driver::restore_scale(float s) {
if (s != 1.f && Fl_Display_Device::display_device()->is_current()) {
scale(s);
cairo_scale(cairo_, s, s);
Fl_Graphics_Driver::scale(s);
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ void Fl_Quartz_Graphics_Driver::cache_size(Fl_Image *img, int &width, int &heigh
float Fl_Quartz_Graphics_Driver::override_scale() {
float s = scale();
if (s != 1.f && Fl_Display_Device::display_device()->is_current()) {
scale(1);
CGContextScaleCTM(gc_, 1./s, 1./s);
Fl_Graphics_Driver::scale(1);
}
return s;
}

void Fl_Quartz_Graphics_Driver::restore_scale(float s) {
if (s != 1.f && Fl_Display_Device::display_device()->is_current()) {
scale(s);
CGContextScaleCTM(gc_, s, s);
Fl_Graphics_Driver::scale(s);
}
}

0 comments on commit 981aa8c

Please sign in to comment.