Mercurial > octave
changeset 26417:4166610a41bc stable
do not include private file oct-opengl.h in public headers (bug #55277)
* gl-render.cc (opengl_renderer::get_string): Move HAVE_OPENGL conditional
inside function definition.
* gl-render.h: Do not include oct-opengl.h, add forward decl of
opengl_functions, delete HAVE_OPENGL conditional from public header.
* gl2ps-print.h: Do not include oct-opengl.h, add forward decl of
opengl_functions.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Thu, 03 Jan 2019 14:15:08 -0800 |
parents | c36321a88d17 |
children | 7bdeaa38f2b8 |
files | libinterp/corefcn/gl-render.cc libinterp/corefcn/gl-render.h libinterp/corefcn/gl2ps-print.h |
diffstat | 3 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc Sun Dec 30 13:28:03 2018 -0800 +++ b/libinterp/corefcn/gl-render.cc Thu Jan 03 14:15:08 2019 -0800 @@ -4486,23 +4486,33 @@ #endif } + std::string + opengl_renderer::get_string (unsigned int id) const + { #if defined (HAVE_OPENGL) - std::string - opengl_renderer::get_string (GLenum id) const - { // This is kind of ugly, but glGetString returns a pointer to GLubyte // and there is no std::string constructor that matches. Is there a // better way? std::ostringstream buf; - buf << m_glfcns.glGetString (id); + buf << m_glfcns.glGetString (static_cast<GLenum> (id)); return std::string (buf.str ()); - } + +#else + + octave_unused_parameter (id); + + // This shouldn't happen because construction of opengl_renderer + // objects is supposed to be impossible if OpenGL is not available. + + panic_impossible (); + return std::string (); #endif + } void opengl_renderer::set_normal (int bfl_mode, const NDArray& n, int j, int i)
--- a/libinterp/corefcn/gl-render.h Sun Dec 30 13:28:03 2018 -0800 +++ b/libinterp/corefcn/gl-render.h Thu Jan 03 14:15:08 2019 -0800 @@ -26,11 +26,12 @@ #include "octave-config.h" #include "graphics.h" -#include "oct-opengl.h" #include "text-renderer.h" namespace octave { + class opengl_functions; + class OCTINTERP_API opengl_renderer @@ -168,9 +169,7 @@ void init_maxlights (void); -#if defined (HAVE_OPENGL) - std::string get_string (GLenum id) const; -#endif + std::string get_string (unsigned int id) const; bool is_nan_or_inf (double x, double y, double z) const {
--- a/libinterp/corefcn/gl2ps-print.h Sun Dec 30 13:28:03 2018 -0800 +++ b/libinterp/corefcn/gl2ps-print.h Thu Jan 03 14:15:08 2019 -0800 @@ -27,11 +27,12 @@ #include <string> -#include "oct-opengl.h" #include "graphics.h" namespace octave { + class opengl_functions; + extern OCTINTERP_API void gl2ps_print (opengl_functions& glfcns, const graphics_object& fig, const std::string& stream, const std::string& term);