[master] 9df287b - Cleaner access to Fl_Gl_Window_Driver objects.

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 9df287b - Cleaner access to Fl_Gl_Window_Driver objects. "ManoloFLTK" 01:47 Apr 29 top right image
 
commit 9df287b415cd4d67a7a371c4cc89a11ebb8340f6
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Apr 29 10:40:02 2021 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Apr 29 10:40:18 2021 +0200

    Cleaner access to Fl_Gl_Window_Driver objects.

 FL/Fl_Gl_Window.H                               | 5 -----
 src/Fl_Gl_Window_Driver.H                       | 1 +
 src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx | 2 +-
 src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx     | 2 +-
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git FL/Fl_Gl_Window.H FL/Fl_Gl_Window.H
index 0204c3e..e3279f9 100644
--- FL/Fl_Gl_Window.H
+++ FL/Fl_Gl_Window.H
@@ -50,13 +50,8 @@ class Fl_Gl_Window_Driver;
 */
 class FL_EXPORT Fl_Gl_Window : public Fl_Window {
   friend class Fl_Gl_Window_Driver;
-  friend class _Fl_Gl_Overlay;
-  friend class Fl_OpenGL_Display_Device;
   Fl_Gl_Window_Driver *pGlWindowDriver;
 
-  /** Returns a pointer to the window's Fl_Gl_Window_Driver object */
-  Fl_Gl_Window_Driver *gl_driver() {return pGlWindowDriver;}
-
   int mode_;
   const int *alist;
   Fl_Gl_Choice *g;
diff --git src/Fl_Gl_Window_Driver.H src/Fl_Gl_Window_Driver.H
index bebde10..ae2c66f 100644
--- src/Fl_Gl_Window_Driver.H
+++ src/Fl_Gl_Window_Driver.H
@@ -100,6 +100,7 @@ public:
   virtual int genlistsize() { return 0; } // support for gl_draw()
   virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum);
   virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h);
+  static inline Fl_Gl_Window_Driver* driver(const Fl_Gl_Window *win) {return win->pGlWindowDriver;}
 };
 
 #endif /* Fl_Gl_Window_Driver_H */
diff --git src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
index 121c0db..1d0b25c 100644
--- src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
+++ src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
@@ -40,7 +40,7 @@ Fl_OpenGL_Display_Device::Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *gr
 
 Fl_RGB_Image* Fl_OpenGL_Display_Device::capture_gl_rectangle(Fl_Gl_Window* glw, int x, int y, int w, int h)
 {
-  return glw->gl_driver()->capture_gl_rectangle(x, y, w, h);
+  return Fl_Gl_Window_Driver::driver(glw)->capture_gl_rectangle(x, y, w, h);
 }
 
 /* Captures a rectangle of a Fl_Gl_Window and returns it as a RGB image.
diff --git src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
index a52d4c7..ac7041f 100644
--- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
+++ src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
@@ -430,7 +430,7 @@ void _Fl_Gl_Overlay::draw() {
   uchar save_valid = w->valid();
   w->valid(valid());
   Fl_Xlib_Graphics_Driver::fl_overlay = 1;
-  w->gl_driver()->draw_overlay();
+  Fl_Gl_Window_Driver::driver(w)->draw_overlay();
   Fl_Xlib_Graphics_Driver::fl_overlay = 0;
   valid(w->valid());
   w->valid(save_valid);
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2021 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.