Fix: Changing default color palette affects opengl child drawing on Wayland (#989)
This commit is contained in:
parent
e5693efb75
commit
b17357339f
@ -56,8 +56,6 @@ private:
|
||||
void redraw_overlay() FL_OVERRIDE;
|
||||
void gl_start() FL_OVERRIDE;
|
||||
void gl_visual(Fl_Gl_Choice *c) FL_OVERRIDE;
|
||||
char *alpha_mask_for_string(
|
||||
const char *str, int n, int w, int h, Fl_Fontsize fs) FL_OVERRIDE;
|
||||
void init();
|
||||
public:
|
||||
//virtual bool need_scissor() { return true; } // CONTROL_LEAKING_SUB_GL_WINDOWS
|
||||
|
@ -107,35 +107,6 @@ void Fl_Wayland_Gl_Window_Driver::init() {
|
||||
}
|
||||
|
||||
|
||||
char *Fl_Wayland_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_Surface_Device::push_current(surf);
|
||||
fl_color(FL_BLACK);
|
||||
fl_rectf(0, 0, w, h);
|
||||
fl_color(FL_WHITE);
|
||||
fl_font(f, fs);
|
||||
fl_draw(str, n, 0, fl_height() - fl_descent());
|
||||
// get the R channel only of the bitmap
|
||||
char *alpha_buf = new char[w*h], *r = alpha_buf;
|
||||
struct Fl_Wayland_Graphics_Driver::draw_buffer *off =
|
||||
Fl_Wayland_Graphics_Driver::offscreen_buffer(surf->offscreen());
|
||||
for (int i = 0; i < h; i++) {
|
||||
uchar *q = off->buffer + i * off->stride;
|
||||
for (int j = 0; j < w; j++) {
|
||||
*r++ = *q;
|
||||
q += 4;
|
||||
}
|
||||
}
|
||||
Fl_Surface_Device::pop_current();
|
||||
delete surf;
|
||||
return alpha_buf;
|
||||
}
|
||||
|
||||
|
||||
Fl_Gl_Choice *Fl_Wayland_Gl_Window_Driver::find(int m, const int *alistp)
|
||||
{
|
||||
m |= FL_DOUBLE;
|
||||
|
Loading…
Reference in New Issue
Block a user