Mercurial > octave
changeset 31751:e863066429f1
assume QOffscreenSurface is available
QOffscreenSurface was introduced in Qt 5.1.
* acinclude.m4 (OCTAVE_CHECK_QT_OPENGL_OFFSCREEN_OK): Delete.
(OCTAVE_CHECK_QT_VERSION): Delete use.
* configure.ac, geometryimages.m, interpimages.m, module.mk,
plotimages.m, sparseimages.m, splineimages.m, GLCanvas.cc, GLCanvas.h,
getframe.m, __check_rendering_capability__.m, copyobj.m, hgsave.m,
jupyter-notebook.tst, publish.tst: Eliminate checks for Qt
OffscreenSurface feature. Assume it is always available.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 17 Jan 2023 13:11:02 -0500 |
parents | 85723a361b2b |
children | 345a3f5890e7 |
files | configure.ac doc/interpreter/geometryimages.m doc/interpreter/interpimages.m doc/interpreter/module.mk doc/interpreter/plotimages.m doc/interpreter/sparseimages.m doc/interpreter/splineimages.m libgui/graphics/GLCanvas.cc libgui/graphics/GLCanvas.h m4/acinclude.m4 scripts/image/getframe.m scripts/plot/util/__check_rendering_capability__.m scripts/plot/util/copyobj.m scripts/plot/util/hgsave.m test/jupyter-notebook/jupyter-notebook.tst test/publish/publish.tst |
diffstat | 16 files changed, 23 insertions(+), 109 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Tue Jan 17 10:27:03 2023 -0500 +++ b/configure.ac Tue Jan 17 13:11:02 2023 -0500 @@ -2662,7 +2662,7 @@ fi], []) if test $ENABLE_DOCS = yes; then - if test $opengl_graphics = no || test "$have_qt_opengl_offscreen" = no; then + if test $opengl_graphics = no; then if test -n "$warn_gnuplot"; then ENABLE_DOCS=no warn_docs_graphics="building documentation disabled because no suitable graphics toolkit is available; make dist will fail."
--- a/doc/interpreter/geometryimages.m Tue Jan 17 10:27:03 2023 -0500 +++ b/doc/interpreter/geometryimages.m Tue Jan 17 13:11:02 2023 -0500 @@ -154,8 +154,7 @@ function set_graphics_toolkit () if (isempty (available_graphics_toolkits ())) error ("no graphics toolkit available for plotting"); - elseif (strcmp ("qt", graphics_toolkit ()) - && __have_feature__ ("QT_OFFSCREEN")) + elseif (strcmp ("qt", graphics_toolkit ())) ## Use qt with QOffscreenSurface for plot elseif (! strcmp ("gnuplot", graphics_toolkit ())) if (! any (strcmp ("gnuplot", available_graphics_toolkits ())))
--- a/doc/interpreter/interpimages.m Tue Jan 17 10:27:03 2023 -0500 +++ b/doc/interpreter/interpimages.m Tue Jan 17 13:11:02 2023 -0500 @@ -96,8 +96,7 @@ function set_graphics_toolkit () if (isempty (available_graphics_toolkits ())) error ("no graphics toolkit available for plotting"); - elseif (strcmp ("qt", graphics_toolkit ()) - && __have_feature__ ("QT_OFFSCREEN")) + elseif (strcmp ("qt", graphics_toolkit ())) ## Use qt with QOffscreenSurface for plot elseif (! strcmp ("gnuplot", graphics_toolkit ())) if (! any (strcmp ("gnuplot", available_graphics_toolkits ())))
--- a/doc/interpreter/module.mk Tue Jan 17 10:27:03 2023 -0500 +++ b/doc/interpreter/module.mk Tue Jan 17 13:11:02 2023 -0500 @@ -369,7 +369,6 @@ @$(GREP) '#define HAVE_CHOLMOD 1' $(top_builddir)/config.h > /dev/null || { echo "Documentation creation requires missing CHOLMOD library. Cannot package distribution!" ; exit 1; } @$(GREP) '#define HAVE_UMFPACK 1' $(top_builddir)/config.h > /dev/null || { echo "Documentation creation requires missing UMFPACK library. Cannot package distribution!" ; exit 1; } @$(GREP) '#define HAVE_QHULL 1' $(top_builddir)/config.h > /dev/null || { echo "Documentation creation requires missing QHULL library. Cannot package distribution!" ; exit 1; } - @$(GREP) '#define HAVE_QT_OFFSCREEN 1' $(top_builddir)/config.h > /dev/null || { echo "Documentation creation requires Qt offscreen OpenGL rendering. Cannot package distribution!" ; exit 1; } $(MUNGED_TEXI_SRC): $(DOCSTRING_FILES)
--- a/doc/interpreter/plotimages.m Tue Jan 17 10:27:03 2023 -0500 +++ b/doc/interpreter/plotimages.m Tue Jan 17 13:11:02 2023 -0500 @@ -154,8 +154,7 @@ function set_graphics_toolkit () if (isempty (available_graphics_toolkits ())) error ("no graphics toolkit available for plotting"); - elseif (strcmp ("qt", graphics_toolkit ()) - && __have_feature__ ("QT_OFFSCREEN")) + elseif (strcmp ("qt", graphics_toolkit ())) ## Use qt with QOffscreenSurface for plot elseif (! strcmp ("gnuplot", graphics_toolkit ())) if (! any (strcmp ("gnuplot", available_graphics_toolkits ())))
--- a/doc/interpreter/sparseimages.m Tue Jan 17 10:27:03 2023 -0500 +++ b/doc/interpreter/sparseimages.m Tue Jan 17 13:11:02 2023 -0500 @@ -256,8 +256,7 @@ function set_graphics_toolkit () if (isempty (available_graphics_toolkits ())) error ("no graphics toolkit available for plotting"); - elseif (strcmp ("qt", graphics_toolkit ()) - && __have_feature__ ("QT_OFFSCREEN")) + elseif (strcmp ("qt", graphics_toolkit ())) ## Use qt with QOffscreenSurface for plot elseif (! strcmp ("gnuplot", graphics_toolkit ())) if (! any (strcmp ("gnuplot", available_graphics_toolkits ())))
--- a/doc/interpreter/splineimages.m Tue Jan 17 10:27:03 2023 -0500 +++ b/doc/interpreter/splineimages.m Tue Jan 17 13:11:02 2023 -0500 @@ -186,8 +186,7 @@ function set_graphics_toolkit () if (isempty (available_graphics_toolkits ())) error ("no graphics toolkit available for plotting"); - elseif (strcmp ("qt", graphics_toolkit ()) - && __have_feature__ ("QT_OFFSCREEN")) + elseif (strcmp ("qt", graphics_toolkit ())) ## Use qt with QOffscreenSurface for plot elseif (! strcmp ("gnuplot", graphics_toolkit ())) if (! any (strcmp ("gnuplot", available_graphics_toolkits ())))
--- a/libgui/graphics/GLCanvas.cc Tue Jan 17 10:27:03 2023 -0500 +++ b/libgui/graphics/GLCanvas.cc Tue Jan 17 13:11:02 2023 -0500 @@ -290,7 +290,6 @@ if (! isValid ()) { -# if defined (HAVE_QT_OFFSCREEN) static bool os_ctx_ok = true; if (os_ctx_ok && ! m_os_context.isValid ()) { @@ -304,9 +303,6 @@ } retval = m_os_context.makeCurrent (&m_os_surface); -# else - retval = false; -# endif } else makeCurrent ();
--- a/libgui/graphics/GLCanvas.h Tue Jan 17 10:27:03 2023 -0500 +++ b/libgui/graphics/GLCanvas.h Tue Jan 17 13:11:02 2023 -0500 @@ -31,10 +31,8 @@ # define OCTAVE_QT_OPENGL_WIDGET QOpenGLWidget # include <QOpenGLFramebufferObject> # define OCTAVE_QT_OPENGL_FBO QOpenGLFramebufferObject -# if defined (HAVE_QT_OFFSCREEN) -# include <QOpenGLContext> -# include <QOffscreenSurface> -# endif +# include <QOpenGLContext> +# include <QOffscreenSurface> #elif defined (HAVE_QGLWIDGET) # include <QGLWidget> # define OCTAVE_QT_OPENGL_WIDGET QGLWidget @@ -89,10 +87,8 @@ octave::qopengl_functions m_glfcns; octave::opengl_renderer m_renderer; -# if defined (HAVE_QT_OFFSCREEN) QOpenGLContext m_os_context; QOffscreenSurface m_os_surface; -# endif }; OCTAVE_END_NAMESPACE(octave)
--- a/m4/acinclude.m4 Tue Jan 17 10:27:03 2023 -0500 +++ b/m4/acinclude.m4 Tue Jan 17 13:11:02 2023 -0500 @@ -1688,60 +1688,6 @@ AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes]) ]) dnl -dnl Check whether QOffscreenSurface is present. -dnl -AC_DEFUN([OCTAVE_CHECK_QT_OPENGL_OFFSCREEN_OK], [ - dnl Normally the language and compiler flags would be set and restored - dnl inside of the AC_CACHE_CHECK body. Because we also need to check for - dnl Qt header files associated with the compilation test, set and restore - dnl these values outside of the AC_CACHE_CHECK for this macro only. - AC_LANG_PUSH(C++) - ac_octave_save_CPPFLAGS="$CPPFLAGS" - ac_octave_save_CXXFLAGS="$CXXFLAGS" - CPPFLAGS="$QT_OPENGL_CPPFLAGS $CXXPICFLAG $CPPFLAGS" - CXXFLAGS="$CXXPICFLAG $CXXFLAGS" - AC_CHECK_HEADERS([QOffscreenSurface]) - AC_CACHE_CHECK([whether Qt supports full offscreen OpenGL rendering], - [octave_cv_qt_opengl_os_ok], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #if HAVE_WINDOWS_H - # include <windows.h> - #endif - #if defined (HAVE_GL_GL_H) - # include <GL/gl.h> - #elif defined (HAVE_OPENGL_GL_H) - # include <OpenGL/gl.h> - #endif - #if defined (HAVE_GL_GLU_H) - # include <GL/glu.h> - #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL - # include <OpenGL/glu.h> - #endif - #if defined (HAVE_QOPENGLWIDGET) - # include <QOpenGLWidget> - # include <QOpenGLContext> - #endif - #if defined (HAVE_QOFFSCREENSURFACE) - # include <QOffscreenSurface> - #endif - QOpenGLContext ctx; - QOffscreenSurface surf; - ]])], - octave_cv_qt_opengl_os_ok=yes, - octave_cv_qt_opengl_os_ok=no) - ]) - CPPFLAGS="$ac_octave_save_CPPFLAGS" - CXXFLAGS="$ac_octave_save_CXXFLAGS" - AC_LANG_POP(C++) - if test $octave_cv_qt_opengl_os_ok = yes; then - $1 - : - else - $2 - : - fi -]) -dnl dnl Check whether Qt works with full OpenGL support dnl AC_DEFUN([OCTAVE_CHECK_QT_OPENGL_OK], [ @@ -1898,7 +1844,6 @@ build_qt_gui=yes build_qt_graphics=no - have_qt_opengl_offscreen=no win32_terminal=no warn_qt_libraries="" @@ -2063,10 +2008,6 @@ if test $build_qt_graphics = yes; then AC_DEFINE(HAVE_QT_GRAPHICS, 1, [Define to 1 if Qt works with OpenGL libs (GL and GLU)]) - OCTAVE_CHECK_QT_OPENGL_OFFSCREEN_OK([have_qt_opengl_offscreen=yes]) - if test $have_qt_opengl_offscreen = yes; then - AC_DEFINE(HAVE_QT_OFFSCREEN, 1, [Define to 1 if Qt handles offscreen OpenGL rendering]) - fi fi fi
--- a/scripts/image/getframe.m Tue Jan 17 10:27:03 2023 -0500 +++ b/scripts/image/getframe.m Tue Jan 17 13:11:02 2023 -0500 @@ -167,8 +167,9 @@ %! image (frame.cdata); %! title ("Lower left hand corner"); -%!testif HAVE_QT_OFFSCREEN; have_window_system () && strcmp ("qt", graphics_toolkit ()) +%!testif HAVE_OPENGL, HAVE_QT; have_window_system () && any (strcmp ("qt", graphics_toolkit ())) %! hf = figure ("visible", "off"); +%! graphics_toolkit (hf, "qt"); %! unwind_protect %! pos = get (hf, "position"); %! assert (size (getframe (hf).cdata)(1:2), pos(4:-1:3)); @@ -176,8 +177,9 @@ %! close (hf); %! end_unwind_protect -%!testif HAVE_QT_OFFSCREEN; have_window_system () && strcmp ("qt", graphics_toolkit ()) +%!testif HAVE_OPENGL, HAVE_QT; have_window_system () && any (strcmp ("qt", graphics_toolkit ())) %! hf = figure ("visible", "off"); +%! graphics_toolkit (hf, "qt"); %! unwind_protect %! hax = axes ("visible", "off", "position", [0 0 1 1]); %! verts = [0 0; .5 0; 1 0; ...
--- a/scripts/plot/util/__check_rendering_capability__.m Tue Jan 17 10:27:03 2023 -0500 +++ b/scripts/plot/util/__check_rendering_capability__.m Tue Jan 17 13:11:02 2023 -0500 @@ -35,21 +35,12 @@ endif toolkit = get (fig, "__graphics_toolkit__"); - display = getenv ("DISPLAY"); - if (! strcmp (toolkit, "qt")) - error ("%s: rendering with %s toolkit requires visible figure (DISPLAY='%s')", - who, toolkit, display); - endif - - gl_window = get (fig, "__gl_window__"); - qt_offscreen = __have_feature__ ("QT_OFFSCREEN"); - - if (strcmp (gl_window, "on") || qt_offscreen) + if (strcmp (toolkit, "qt")) return; endif - error ("%s: offscreen rendering with %s toolkit requires __gl_window__='on' or QT_OFFSCREEN feature (__gl_window__='%s'; QT_OFFSCREEN=%d, DISPLAY='%s')", - who, toolkit, gl_window, qt_offscreen, display); + error ("%s: rendering with %s toolkit requires visible figure (DISPLAY='%s')", + who, toolkit, getenv ("DISPLAY")); endfunction
--- a/scripts/plot/util/copyobj.m Tue Jan 17 10:27:03 2023 -0500 +++ b/scripts/plot/util/copyobj.m Tue Jan 17 13:11:02 2023 -0500 @@ -203,7 +203,7 @@ %! set (hnew, "position", [scrn(3)/2, scrn(4)/2-pos(4)/2, pos(3:4)]); %! drawnow (); -%!testif HAVE_MAGICK; (have_window_system () && __have_feature__ ("QT_OFFSCREEN") && any (strcmp ("qt", available_graphics_toolkits ()))); +%!testif HAVE_MAGICK; (have_window_system () && any (strcmp ("qt", available_graphics_toolkits ()))); %! toolkit = graphics_toolkit (); %! graphics_toolkit ("qt"); %! unwind_protect
--- a/scripts/plot/util/hgsave.m Tue Jan 17 10:27:03 2023 -0500 +++ b/scripts/plot/util/hgsave.m Tue Jan 17 13:11:02 2023 -0500 @@ -90,7 +90,7 @@ endfunction -%!testif HAVE_MAGICK; (have_window_system () && __have_feature__ ("QT_OFFSCREEN") && any (strcmp ("qt", available_graphics_toolkits ()))); +%!testif HAVE_MAGICK; (have_window_system () && any (strcmp ("qt", available_graphics_toolkits ()))); %! toolkit = graphics_toolkit (); %! graphics_toolkit ("qt"); %! h1 = figure ("visible", "off", "paperposition", [0.25, 2.5, 8.0, 6.0]);
--- a/test/jupyter-notebook/jupyter-notebook.tst Tue Jan 17 10:27:03 2023 -0500 +++ b/test/jupyter-notebook/jupyter-notebook.tst Tue Jan 17 13:11:02 2023 -0500 @@ -28,8 +28,7 @@ %! visibility = get (0, "defaultfigurevisible"); %! toolkit = graphics_toolkit (); %! unwind_protect -%! if (! __have_feature__ ("QT_OFFSCREEN") -%! || ! strcmp (graphics_toolkit (), "qt")) +%! if (! strcmp (graphics_toolkit (), "qt")) %! try %! graphics_toolkit ("gnuplot"); %! catch @@ -63,8 +62,7 @@ %! visibility = get (0, "defaultfigurevisible"); %! toolkit = graphics_toolkit (); %! unwind_protect -%! if (! __have_feature__ ("QT_OFFSCREEN") -%! || ! strcmp (graphics_toolkit (), "qt")) +%! if (! strcmp (graphics_toolkit (), "qt")) %! try %! graphics_toolkit ("gnuplot"); %! catch @@ -102,8 +100,7 @@ %! visibility = get (0, "defaultfigurevisible"); %! toolkit = graphics_toolkit (); %! unwind_protect -%! if (! __have_feature__ ("QT_OFFSCREEN") -%! || ! strcmp (graphics_toolkit (), "qt")) +%! if (! strcmp (graphics_toolkit (), "qt")) %! try %! graphics_toolkit ("gnuplot"); %! catch @@ -146,8 +143,7 @@ %! visibility = get (0, "defaultfigurevisible"); %! toolkit = graphics_toolkit (); %! unwind_protect -%! if (! __have_feature__ ("QT_OFFSCREEN") -%! || ! strcmp (graphics_toolkit (), "qt")) +%! if (! strcmp (graphics_toolkit (), "qt")) %! try %! graphics_toolkit ("gnuplot"); %! catch
--- a/test/publish/publish.tst Tue Jan 17 10:27:03 2023 -0500 +++ b/test/publish/publish.tst Tue Jan 17 13:11:02 2023 -0500 @@ -29,8 +29,7 @@ %! visibility = get (0, "defaultfigurevisible"); %! toolkit = graphics_toolkit (); %! unwind_protect -%! if (! __have_feature__ ("QT_OFFSCREEN") -%! || ! strcmp (graphics_toolkit (), "qt")) +%! if (! strcmp (graphics_toolkit (), "qt")) %! try %! graphics_toolkit ("gnuplot"); %! catch @@ -61,8 +60,7 @@ %! visibility = get (0, "defaultfigurevisible"); %! toolkit = graphics_toolkit (); %! unwind_protect -%! if (! __have_feature__ ("QT_OFFSCREEN") -%! || ! strcmp (graphics_toolkit (), "qt")) +%! if (! strcmp (graphics_toolkit (), "qt")) %! try %! graphics_toolkit ("gnuplot"); %! catch