comparison libinterp/dldfcn/__osmesa_print__.cc @ 20131:bb59bdbdb8ac

Fix compilation error when building with OSMesa but without gl2ps (bug #44870) * __osmesa_print__.cc (F__osmesa_print__): Add #ifdef HAVE_GL2PS_H block around section that requires gl2ps. Add HAVE_GL2PS_H to %!tests.
author Andreas Weber <andy.weber.aw@gmail.com>
date Sun, 19 Apr 2015 10:13:04 -0400
parents f1b67f6e6e45
children f90c8372b7ba
comparison
equal deleted inserted replaced
20130:c164cfc24bdd 20131:bb59bdbdb8ac
174 } 174 }
175 175
176 if (nargin == 3) 176 if (nargin == 3)
177 { 177 {
178 // use gl2ps 178 // use gl2ps
179 #ifndef HAVE_GL2PS_H
180 gripe_disabled_feature ("__osmesa_print__", "gl2ps");
181 #else
179 std::string file = args(1).string_value (); 182 std::string file = args(1).string_value ();
180 std::string term = args(2).string_value (); 183 std::string term = args(2).string_value ();
181 184
182 if (! error_state) 185 if (! error_state)
183 { 186 {
213 } 216 }
214 else 217 else
215 error ("__osmesa_print__: Couldn't create file \"%s\"", file.c_str ()); 218 error ("__osmesa_print__: Couldn't create file \"%s\"", file.c_str ());
216 } 219 }
217 } 220 }
221 #endif
218 } 222 }
219 else 223 else
220 { 224 {
221 // return RGB image 225 // return RGB image
222 opengl_renderer rend; 226 opengl_renderer rend;
259 /* 263 /*
260 ## FIXME: osmesa does not work correctly on Windows platforms. 264 ## FIXME: osmesa does not work correctly on Windows platforms.
261 ## This is not critical, since this facility will mostly be used in 265 ## This is not critical, since this facility will mostly be used in
262 ## the future for generating the images in Octave's own documentation. 266 ## the future for generating the images in Octave's own documentation.
263 ## For the moment, disable these tests on PC's and Macs. 267 ## For the moment, disable these tests on PC's and Macs.
264 %!testif HAVE_OSMESA 268 %!testif HAVE_OSMESA, HAVE_GL2PS_H
265 %! if (isunix ()) 269 %! if (isunix ())
266 %! h = figure ("visible", "off"); 270 %! h = figure ("visible", "off");
267 %! fn = tempname (); 271 %! fn = tempname ();
268 %! sombrero (); 272 %! sombrero ();
269 %! __osmesa_print__ (h, fn, "svg"); 273 %! __osmesa_print__ (h, fn, "svg");
274 %! ## Use pixel sum per RGB channel as fingerprint 278 %! ## Use pixel sum per RGB channel as fingerprint
275 %! img_fp = squeeze (sum (sum (img), 2)); 279 %! img_fp = squeeze (sum (sum (img), 2));
276 %! assert (img_fp, [52942515; 54167797; 56158178], -0.05); 280 %! assert (img_fp, [52942515; 54167797; 56158178], -0.05);
277 %! endif 281 %! endif
278 282
279 %!testif HAVE_OSMESA 283 %!testif HAVE_OSMESA, HAVE_GL2PS_H
280 %! if (isunix ()) 284 %! if (isunix ())
281 %! h = figure ("visible", "off"); 285 %! h = figure ("visible", "off");
282 %! fn = tempname (); 286 %! fn = tempname ();
283 %! plot (sin (0:0.1:2*pi)); 287 %! plot (sin (0:0.1:2*pi));
284 %! __osmesa_print__ (h, fn, "svgis2d"); 288 %! __osmesa_print__ (h, fn, "svgis2d");