Add a few missing virtual members to Fl_Cairo_Graphics_Driver.

This commit is contained in:
ManoloFLTK 2022-08-18 16:22:28 +02:00
parent 2cfb5fcc57
commit 6194b736eb
2 changed files with 39 additions and 0 deletions

View File

@ -188,6 +188,11 @@ public:
virtual void XDestroyRegion(Fl_Region r);
virtual void add_rectangle_to_region(Fl_Region r, int X, int Y, int W, int H);
virtual void cache_size(Fl_Image *img, int &width, int &height);
virtual char can_do_alpha_blending();
virtual float override_scale();
virtual void restore_scale(float);
virtual void antialias(int state);
virtual int antialias();
};
#endif // FL_CAIRO_GRAPHICS_DRIVER_H

View File

@ -22,6 +22,7 @@
#if USE_PANGO
#include "Fl_Cairo_Graphics_Driver.H"
#include "../../Fl_Screen_Driver.H"
#include <FL/platform.H>
#include <FL/fl_draw.H>
#include <cairo/cairo.h>
@ -1306,4 +1307,37 @@ void Fl_Cairo_Graphics_Driver::cache_size(Fl_Image *unused, int &width, int &hei
height *= matrix.xx;
}
char Fl_Cairo_Graphics_Driver::can_do_alpha_blending() {
return 1;
}
float Fl_Cairo_Graphics_Driver::override_scale() {
float s = scale();
if (s != 1.f && Fl_Display_Device::display_device()->is_current()) {
Fl::screen_driver()->scale(0, 1.f);
cairo_scale(cairo_, 1/s, 1/s);
}
return s;
}
void Fl_Cairo_Graphics_Driver::restore_scale(float s) {
if (s != 1.f && Fl_Display_Device::display_device()->is_current()) {
Fl::screen_driver()->scale(0, s);
cairo_scale(cairo_, s, s);
}
}
void Fl_Cairo_Graphics_Driver::antialias(int state) {
cairo_set_antialias(cairo_, state ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
}
int Fl_Cairo_Graphics_Driver::antialias() {
return (cairo_get_antialias(cairo_) != CAIRO_ANTIALIAS_NONE);
}
#endif // USE_PANGO