diff options
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx index a9df988c3..84541e0fa 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx @@ -53,7 +53,8 @@ class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver { virtual void make_overlay_current(); virtual void redraw_overlay(); virtual void gl_start(); - virtual char *alpha_mask_for_string(const char *str, int n, int w, int h); + virtual Fl_Fontsize effective_size(); + virtual char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs); virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h); }; @@ -219,14 +220,18 @@ void Fl_Cocoa_Gl_Window_Driver::resize(int is_a_resize, int w, int h) { /* Some old Apple hardware doesn't implement the GL_EXT_texture_rectangle extension. For it, draw_string_legacy_glut() is used to draw text. */ -char *Fl_Cocoa_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h) +Fl_Fontsize Fl_Cocoa_Gl_Window_Driver::effective_size() { + return (Fl_Fontsize)round(fl_graphics_driver->size() * gl_scale); +} + +char *Fl_Cocoa_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs) { // write str to a bitmap just big enough Fl_Image_Surface *surf = new Fl_Image_Surface(w, h); - Fl_Font f=fl_font(); Fl_Fontsize s=fl_size(); + Fl_Font f=fl_font(); Fl_Surface_Device::push_current(surf); fl_color(FL_WHITE); - fl_font(f, s * gl_scale); + fl_font(f, fs); fl_draw(str, n, 0, fl_height() - fl_descent()); // get the alpha channel only of the bitmap char *alpha_buf = new char[w*h], *r = alpha_buf, *q; |
