summaryrefslogtreecommitdiff
path: root/src/gl_draw.cxx
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/gl_draw.cxx
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/gl_draw.cxx')
-rw-r--r--src/gl_draw.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx
index 234edf275..043d1c1f3 100644
--- a/src/gl_draw.cxx
+++ b/src/gl_draw.cxx
@@ -412,7 +412,8 @@ int gl_texture_fifo::compute_texture(const char* str, int n)
fifo[current].scale = Fl_Gl_Window_Driver::gl_scale;
fifo[current].fdesc = gl_fontsize;
- char *alpha_buf = Fl_Gl_Window_Driver::global()->alpha_mask_for_string(str, n, w, h);
+ Fl_Fontsize fs = Fl_Gl_Window_Driver::global()->effective_size();
+ char *alpha_buf = Fl_Gl_Window_Driver::global()->alpha_mask_for_string(str, n, w, h, fs);
// save GL parameters GL_UNPACK_ROW_LENGTH and GL_UNPACK_ALIGNMENT
GLint row_length, alignment;
@@ -496,8 +497,11 @@ void Fl_Gl_Window_Driver::draw_string_with_texture(const char* str, int n)
gl_fifo->display_texture(index);
}
+Fl_Fontsize Fl_Gl_Window_Driver::effective_size() {
+ return fl_graphics_driver->font_descriptor()->size;
+}
-char *Fl_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h)
+char *Fl_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs)
{
// write str to a bitmap that is just big enough
// create an Fl_Image_Surface object
@@ -511,7 +515,7 @@ char *Fl_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w,
// set up the text colour as white, which we will interpret as opaque
fl_color(255,255,255);
// Fix the font scaling
- fl_font (fnt, gl_fontsize->size); // resize "fltk" font to current GL view scaling
+ fl_font (fnt, fs); // resize "fltk" font to current GL view scaling
int desc = fl_descent();
// Render the text to the buffer
fl_draw(str, n, 0, h - desc);