changeset 13961:0fea4cf22f88

restore legend text with OpenGL + FLTK graphics (bug #34907) * gl-render.cc (opengl_rendereer::draw_text): Avoid indexing past end of position matrix.
author John W. Eaton <jwe@octave.org>
date Tue, 29 Nov 2011 18:56:54 -0500
parents ef96344a6e58
children efa658122cc9
files src/gl-render.cc
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gl-render.cc	Tue Nov 29 12:16:49 2011 -0500
+++ b/src/gl-render.cc	Tue Nov 29 18:56:54 2011 -0500
@@ -2460,7 +2460,7 @@
   if (props.get_string ().is_empty ())
     return;
 
-  const Matrix pos = xform.scale (props.get_data_position ());
+  Matrix pos = xform.scale (props.get_data_position ());
   const Matrix bbox = props.get_extent_matrix ();
 
   // FIXME: handle margin and surrounding box
@@ -2468,7 +2468,7 @@
 
   glEnable (GL_BLEND);
   glEnable (GL_ALPHA_TEST);
-  glRasterPos3d (pos(0), pos(1), pos(2));
+  glRasterPos3d (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0);
   glBitmap(0, 0, 0, 0, bbox(0), bbox(1), 0);
   glDrawPixels (bbox(2), bbox(3),
                 GL_RGBA, GL_UNSIGNED_BYTE, props.get_pixels ().data ());