Mercurial > octave
diff libinterp/corefcn/gl2ps-print.cc @ 23859:7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
* graphics.in.h (axes::properties::has3Dkids, axes::properties::set_has3Dkids):
New private attribute and corresponding setter
* graphics.in.h (axes::properties::get_is2D): add bool argument to specify
whether to include kids in the dimensionality check. Make use of new
"has3Dkids" propetrty when necessary.
* graphics.cc (axes::update_axis_limits): Set has3Dkids attribute based on
Z limits. Allow zlim to be checked (but unchanged) even when zlimmode is
manual and add a FIXME note.
* gl2ps-print.cc (gl2ps_renderer::has_2D_axes): New method to check all axes
are 2D.
* gl2ps-print.cc (gl2ps_renderer::draw): Choose sorting algorithm depending on
has_2D_axes.
* __opengl_print__.m: Don't check dimensionality here.
* gl-render.cc (opengl_renderer::draw_axes): include children in dimensionality
check.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Thu, 20 Jul 2017 22:59:27 +0200 |
parents | cb8251337689 |
children | 56b7352fa456 |
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-print.cc Wed Aug 09 19:54:18 2017 -0700 +++ b/libinterp/corefcn/gl2ps-print.cc Thu Jul 20 22:59:27 2017 +0200 @@ -201,6 +201,35 @@ bool buffer_overflow; }; + static bool + has_2D_axes (const graphics_handle& h) + { + bool retval = true; + graphics_object go = gh_manager::get_object (h); + + if (! go.valid_object ()) + return retval; + + if (go.isa ("figure") || go.isa ("uipanel")) + { + Matrix children = go.get ("children").matrix_value (); + for (octave_idx_type ii = 0; ii < children.numel (); ii++) + { + retval = has_2D_axes (graphics_handle (children(ii))); + if (! retval) + break; + } + } + else if (go.isa ("axes")) + { + axes::properties& ap + = reinterpret_cast<axes::properties&> (go.get_properties ()); + retval = ap.get_is2D (true); + } + + return retval; + } + void gl2ps_renderer::draw (const graphics_object& go, const std::string& print_cmd) { @@ -240,10 +269,9 @@ // Default sort order optimizes for 3D plots GLint gl2ps_sort = GL2PS_BSP_SORT; - // For 2D plots we can use a simpler Z-depth sorting algorithm // FIXME: gl2ps does not provide a way to change the sorting algorythm // on a viewport basis, we thus disable sorting only if all axes are 2D - if (term.find ("is2D") != std::string::npos) + if (has_2D_axes (go.get ("__myhandle__"))) gl2ps_sort = GL2PS_NO_SORT; // Use a temporary file in case an overflow happens