Mercurial > octave
changeset 22838:1444a65085ca
Make axes corners join in printout (bug #39643)
* gl-render.h (opengl_renderer::set_linecap) new method that does nothing by
default
* gl-render.cc (opengl_renderer::draw_surface/line/patch) force "butt" line cap
* gl-render.cc (opengl_renderer::draw_axes) force "square" line cap
* gl2ps-print.cc (gl2ps_renderer::set_linecap) call gl2psLineCap conditioned on
HAVE_GL2PSLINEJOIN (both functions were introduced at the same time)
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Fri, 18 Nov 2016 16:55:20 +0100 |
parents | b125351d4243 |
children | b27125252bb0 |
files | libinterp/corefcn/gl-render.cc libinterp/corefcn/gl-render.h libinterp/corefcn/gl2ps-print.cc |
diffstat | 3 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc Mon Nov 28 12:20:27 2016 -0800 +++ b/libinterp/corefcn/gl-render.cc Fri Nov 18 16:55:20 2016 +0100 @@ -2010,6 +2010,7 @@ set_font (props); set_interpreter (props.get_ticklabelinterpreter ()); + set_linecap ("square"); set_linewidth (props.get_linewidth ()); // draw axes object @@ -2077,6 +2078,7 @@ set_color (props.get_color_rgb ()); set_linestyle (props.get_linestyle (), false, props.get_linewidth ()); set_linewidth (props.get_linewidth ()); + set_linecap ("butt"); set_linejoin (props.get_linejoin ()); if (has_z) @@ -2505,6 +2507,7 @@ set_linestyle (props.get_linestyle (), false, props.get_linewidth ()); set_linewidth (props.get_linewidth ()); + set_linecap ("butt"); set_linejoin ("miter"); // Mesh along Y-axis @@ -3088,6 +3091,7 @@ double linewidth = props.get_linewidth (); set_linestyle (props.get_linestyle (), false, linewidth); set_linewidth (linewidth); + set_linecap ("butt"); set_linejoin ("miter"); // NOTE: patch contour cannot be offset. Offset must occur with the
--- a/libinterp/corefcn/gl-render.h Mon Nov 28 12:20:27 2016 -0800 +++ b/libinterp/corefcn/gl-render.h Fri Nov 18 16:55:20 2016 +0100 @@ -82,7 +82,8 @@ virtual void set_linewidth (float w); virtual void set_linestyle (const std::string& s, bool stipple = false, double linewidth = 0.5); - virtual void set_linejoin (const std::string& /*s*/) { }; + virtual void set_linecap (const std::string&) { }; + virtual void set_linejoin (const std::string&) { }; virtual void set_clipbox (double x1, double x2, double y1, double y2, double z1, double z2); virtual void set_clipping (bool on);
--- a/libinterp/corefcn/gl2ps-print.cc Mon Nov 28 12:20:27 2016 -0800 +++ b/libinterp/corefcn/gl2ps-print.cc Fri Nov 18 16:55:20 2016 +0100 @@ -124,6 +124,20 @@ gl2psEnable (GL2PS_LINE_STIPPLE); } + void set_linecap (const std::string& s) + { + octave::opengl_renderer::set_linejoin (s); + +#if defined (HAVE_GL2PSLINEJOIN) + if (s == "butt") + gl2psLineCap (GL2PS_LINE_CAP_BUTT); + else if (s == "square") + gl2psLineCap (GL2PS_LINE_CAP_SQUARE); + else if (s == "round") + gl2psLineCap (GL2PS_LINE_CAP_ROUND); +#endif + } + void set_linejoin (const std::string& s) { octave::opengl_renderer::set_linejoin (s);