From 4bf9172a8e4f76842a2e011671cf5c057e8fe1d1 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sun, 23 Apr 2023 10:03:02 +0200 Subject: Replace internal fl_create_offscreen() calls by new Fl_Image_Surface --- src/drivers/PostScript/Fl_PostScript.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/drivers/PostScript/Fl_PostScript.cxx') diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index 1db0cc68c..4ce3f67b9 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -22,6 +22,7 @@ #include #include "Fl_PostScript_Graphics_Driver.H" #include +#include #include #include "../../Fl_System_Driver.H" #include @@ -1128,8 +1129,8 @@ void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int // create an offscreen image of the string Fl_Color text_color = Fl_Graphics_Driver::color(); Fl_Color bg_color = fl_contrast(FL_WHITE, text_color); - Fl_Offscreen off = fl_create_offscreen(w_scaled, (int)(h+3*scale) ); - fl_begin_offscreen(off); + Fl_Image_Surface *off = new Fl_Image_Surface(w_scaled, (int)(h+3*scale), 1); + Fl_Surface_Device::push_current(off); fl_color(bg_color); // color offscreen background with a shade contrasting with the text color fl_rectf(0, 0, w_scaled, (int)(h+3*scale) ); @@ -1147,9 +1148,9 @@ void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int else fl_draw(str, n, 0, (int)(h * 0.8) ); // read (most of) the offscreen image uchar *img = fl_read_image(NULL, 0, 1, w2, h, 0); - fl_end_offscreen(); + Fl_Surface_Device::pop_current(); font(fontnum, old_size); - fl_delete_offscreen(off); + delete off; // compute the mask of what is not the background uchar *img_mask = calc_mask(img, w2, h, bg_color); delete[] img; -- cgit v1.2.3