changeset 27992:46fe22bf1458

Fix size of markers in printouts to match screen (bug #57552). * gl2ps-print.cc (init_marker): Undo the scaling that will occur later in opengl_renderer::make_marker_list by multiplying by the inverse factor of 72.0 / "screenpixelsperinch". Add FIXME note about questionable use of a static variable for this factor. * gl-render.cc (set_linewidth, make_marker_list): Add FIXME note about questionable use of static variable.
author Rik <rik@octave.org>
date Wed, 22 Jan 2020 19:50:50 -0800
parents 55d70dd3a05f
children eaca8df57328
files libinterp/corefcn/gl-render.cc libinterp/corefcn/gl2ps-print.cc
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Wed Jan 22 22:45:01 2020 +0100
+++ b/libinterp/corefcn/gl-render.cc	Wed Jan 22 19:50:50 2020 -0800
@@ -4095,6 +4095,8 @@
     //        pts2pix and m_devpixratio should eventually be combined in to a
     //        a single conversion factor so that only one multiplication per
     //        function call is required.
+    // FIXME: Should this be static?  What happens if window is moved to a second
+    //        monitor with a different screenpixelsperinch?
     const static double pts2pix
       = (gh_mgr.get_object (0).get ("screenpixelsperinch").double_value ()
          / 72.0);
@@ -4469,6 +4471,8 @@
     unsigned int ID = m_glfcns.glGenLists (1);
 
     // FIXME: See bug #53056 (measure LineWidth in points).
+    // FIXME: Should this be static?  What happens if window is moved to a second
+    //        monitor with a different screenpixelsperinch?
     const static double pts2pix
       = (gh_mgr.get_object (0).get ("screenpixelsperinch").double_value ()
          / 72.0);
--- a/libinterp/corefcn/gl2ps-print.cc	Wed Jan 22 22:45:01 2020 +0100
+++ b/libinterp/corefcn/gl2ps-print.cc	Wed Jan 22 19:50:50 2020 -0800
@@ -189,9 +189,17 @@
 
     void init_marker (const std::string& m, double size, float width)
     {
-      opengl_renderer::init_marker (m, size, width);
+      // FIXME: Undo scaling that will take place in opengl_renderer::make_marker_list
+      gh_manager& gh_mgr
+        = __get_gh_manager__ ("gl2ps_renderer::init_marker");
+      // FIXME: Should this be static?  What happens if window is moved to a second
+      //        monitor with a different screenpixelsperinch?
+      const static double rescale
+        = 72.0 / gh_mgr.get_object (0).get ("screenpixelsperinch").double_value ();
 
-      // FIXME: gl2ps can't handle closed contours and we set linecap/linejoin
+      opengl_renderer::init_marker (m, size * rescale, width);
+
+      // FIXME: gl2ps can't handle closed contours so we set linecap/linejoin
       //        round to obtain a better looking result for some markers.
       if (m == "o" || m == "v" || m == "^" || m == ">" || m == "<" || m == "h"
           || m == "hexagram" || m == "p" || m == "pentagram")