summaryrefslogtreecommitdiff
path: root/src/drivers/Cocoa
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-02-19 15:03:21 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-02-19 15:03:32 +0100
commit32f926c360ffad8071cf3a7866907ec2a8153771 (patch)
treeda528a095072e46dcf3f9fe868e50b3b8dfb0ab8 /src/drivers/Cocoa
parent3c37cd033bcc1cc760868bb66772441bb8129acd (diff)
Remove use of static global var gl_fontsize inside virtual member Fl_Gl_Window_Driver::alpha_mask_for_string()
Diffstat (limited to 'src/drivers/Cocoa')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx13
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;