changeset 14389:6b2448555bbd

Fix Z-order stacking of axis background for FLTK printing (bug #35559) * __fltk_print__.m: Pass a 2D option to gl2ps renderer. * gl2ps-renderer.cc (draw): Switch sort order for passing objects to renderer based on 2D option.
author Rik <octave@nomad.inbox5.com>
date Tue, 21 Feb 2012 14:04:05 -0800
parents b5b49f400f9b
children 1928af0f641b
files scripts/plot/private/__fltk_print__.m src/gl2ps-renderer.cc
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/private/__fltk_print__.m	Mon Feb 20 13:41:50 2012 -0800
+++ b/scripts/plot/private/__fltk_print__.m	Tue Feb 21 14:04:05 2012 -0800
@@ -148,6 +148,17 @@
 
   opts.pipeline = pipeline;
 
+  ## Tell gl2ps to use different rendering options for 2D plots
+  haxes = findall (opts.figure, "type", "axes");
+  vw = get (haxes, "view");
+  if (iscell (v))
+    vw = vertcat (vw{:});
+  end
+  is2D = all (abs (vw(:,2)) == 90);
+  if (is2D)
+    gl2ps_device{end} = [gl2ps_device{end}, "is2D"];
+  endif
+
   for n = 1:numel(pipeline)
     if (opts.debug)
       fprintf ("fltk-pipeline: '%s'\n", pipeline{n});
--- a/src/gl2ps-renderer.cc	Mon Feb 20 13:41:50 2012 -0800
+++ b/src/gl2ps-renderer.cc	Tue Feb 21 14:04:05 2012 -0800
@@ -72,11 +72,15 @@
       GLint gl2ps_text = 0;
       if (term.find ("notxt") != std::string::npos) gl2ps_text = GL2PS_NO_TEXT;
 
+      // Default sort order optimizes for 3D plots
+      GLint gl2ps_sort = GL2PS_BSP_SORT;
+      if (term.find ("is2D") != std::string::npos) gl2ps_sort = GL2PS_NO_SORT;
+
       while (state == GL2PS_OVERFLOW)
         {
           buffsize += 1024*1024;
           gl2psBeginPage ("glps_renderer figure", "Octave", viewport,
-                          gl2ps_term, GL2PS_BSP_SORT,
+                          gl2ps_term, gl2ps_sort,
                           (GL2PS_SILENT | GL2PS_SIMPLE_LINE_OFFSET
                            | GL2PS_NO_BLENDING | GL2PS_OCCLUSION_CULL
                            | GL2PS_BEST_ROOT | gl2ps_text