changeset 21391:13b6be3cb217

Correctly print figure background when multiple axes present (bug #47315). * gl2ps-print.cc (draw_axes): Turn off GL2PS_DRAW_BACKGROUND after the first viewport (figure) has been drawn.
author Rik <rik@octave.org>
date Wed, 02 Mar 2016 10:09:22 -0800
parents 4f994c3f88fc
children bd0fcc69e48a
files libinterp/corefcn/gl2ps-print.cc
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-print.cc	Wed Mar 02 00:01:40 2016 -0500
+++ b/libinterp/corefcn/gl2ps-print.cc	Wed Mar 02 10:09:22 2016 -0800
@@ -83,8 +83,7 @@
     glGetIntegerv (GL_VIEWPORT, vp);
     gl2psBeginViewport (vp);
 
-    // Draw and finish () or there may primitives missing in the
-    // gl2ps output.
+    // Draw and finish () or there may primitives missing in the gl2ps output.
     opengl_renderer::draw_axes (props);
     finish ();
 
@@ -96,6 +95,12 @@
       error ("gl2ps_renderer::draw_axes: gl2psEndPage returned GL2PS_ERROR");
 
     buffer_overflow |= (state == GL2PS_OVERFLOW);
+
+    // Don't draw background for subsequent viewports (legends, subplots, etc.)
+    GLint opts;
+    gl2psGetOptions (&opts);
+    opts &= ~GL2PS_DRAW_BACKGROUND;
+    gl2psSetOptions (opts);
   }
 
   void draw_text (const text::properties& props);