Mercurial > octave
changeset 29886:ebd1ac75e99f
use m_ prefix for data members in gl-render classes
* gl-render.h, gl-render.cc, gl2ps-print.cc: Use m_prefix for class
data members.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 15 Jul 2021 16:11:12 -0400 |
parents | 8859d8d1d275 |
children | be669d935fb6 |
files | libinterp/corefcn/gl-render.cc libinterp/corefcn/gl-render.h libinterp/corefcn/gl2ps-print.cc |
diffstat | 3 files changed, 157 insertions(+), 156 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc Thu Jul 15 10:16:37 2021 +0200 +++ b/libinterp/corefcn/gl-render.cc Thu Jul 15 16:11:12 2021 -0400 @@ -680,11 +680,12 @@ #endif opengl_renderer::opengl_renderer (opengl_functions& glfcns) - : m_glfcns (glfcns), xmin (), xmax (), ymin (), ymax (), zmin (), zmax (), - m_devpixratio (1.0), xform (), toolkit (), xZ1 (), xZ2 (), marker_id (), - filled_marker_id (), camera_pos (), camera_dir (), view_vector (), - interpreter ("none"), txt_renderer (), m_current_light (0), - m_max_lights (0), selecting (false), m_printing (false) + : m_glfcns (glfcns), m_xmin (), m_xmax (), m_ymin (), m_ymax (), + m_zmin (), m_zmax (), m_devpixratio (1.0), m_xform (), m_toolkit (), + m_xZ1 (), m_xZ2 (), m_marker_id (), m_filled_marker_id (), + m_camera_pos (), m_camera_dir (), m_view_vector (), + m_interpreter ("none"), m_txt_renderer (), m_current_light (0), + m_max_lights (0), m_selecting (false), m_printing (false) { // This constructor will fail if we don't have OpenGL or if the data // types we assumed in our public interface aren't compatible with the @@ -715,8 +716,8 @@ const base_properties& props = go.get_properties (); - if (! toolkit) - toolkit = props.get_toolkit (); + if (! m_toolkit) + m_toolkit = props.get_toolkit (); if (go.isa ("figure")) draw_figure (dynamic_cast<const figure::properties&> (props)); @@ -1286,8 +1287,8 @@ = std::max (expansion_fac * (x_zlim(1)-x_zlim(0)), single_prec_fac * std::abs (avgZ) * std::numeric_limits<float>::epsilon ()); - xZ1 = avgZ - span; - xZ2 = avgZ + span; + m_xZ1 = avgZ - span; + m_xZ2 = avgZ + span; Matrix x_mat1 = props.get_opengl_matrix_1 (); Matrix x_mat2 = props.get_opengl_matrix_2 (); @@ -1300,7 +1301,7 @@ m_glfcns.glLoadIdentity (); Matrix vp = get_viewport_scaled (); - m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2); + m_glfcns.glOrtho (0, vp(2), vp(3), 0, m_xZ1, m_xZ2); m_glfcns.glMultMatrixd (x_mat2.data ()); m_glfcns.glMatrixMode (GL_MODELVIEW); @@ -1308,7 +1309,7 @@ // store axes transformation data - xform = props.get_transform (); + m_xform = props.get_transform (); #else @@ -1554,7 +1555,7 @@ if (xstate != AXE_DEPTH_DIR && (props.is_visible () - || (selecting && props.pickableparts_is ("all")))) + || (m_selecting && props.pickableparts_is ("all")))) { int zstate = props.get_zstate (); bool x2Dtop = props.get_x2Dtop (); @@ -1579,8 +1580,8 @@ double zpTickN = props.get_zpTickN (); // X ticks and grid properties - Matrix xticks = xform.xscale (props.get_xtick ().matrix_value ()); - Matrix xmticks = xform.xscale (props.get_xminortickvalues ().matrix_value ()); + Matrix xticks = m_xform.xscale (props.get_xtick ().matrix_value ()); + Matrix xmticks = m_xform.xscale (props.get_xminortickvalues ().matrix_value ()); bool do_xminortick = props.is_xminortick () && ! xticks.isempty (); string_vector xticklabels = props.get_xticklabel ().string_vector_value (); int wmax = 0; @@ -1751,7 +1752,7 @@ if (ystate != AXE_DEPTH_DIR && props.is_visible () && (props.is_visible () - || (selecting && props.pickableparts_is ("all")))) + || (m_selecting && props.pickableparts_is ("all")))) { int zstate = props.get_zstate (); bool y2Dright = props.get_y2Dright (); @@ -1776,8 +1777,8 @@ double zpTickN = props.get_zpTickN (); // Y ticks and grid properties - Matrix yticks = xform.yscale (props.get_ytick ().matrix_value ()); - Matrix ymticks = xform.yscale (props.get_yminortickvalues ().matrix_value ()); + Matrix yticks = m_xform.yscale (props.get_ytick ().matrix_value ()); + Matrix ymticks = m_xform.yscale (props.get_yminortickvalues ().matrix_value ()); bool do_yminortick = props.is_yminortick () && ! yticks.isempty (); string_vector yticklabels = props.get_yticklabel ().string_vector_value (); int wmax = 0; @@ -1947,7 +1948,7 @@ if (zstate != AXE_DEPTH_DIR && props.is_visible () && (props.is_visible () - || (selecting && props.pickableparts_is ("all")))) + || (m_selecting && props.pickableparts_is ("all")))) { bool xySym = props.get_xySym (); bool zSign = props.get_zSign (); @@ -1963,8 +1964,8 @@ double z_max = props.get_z_max (); // Z ticks and grid properties - Matrix zticks = xform.zscale (props.get_ztick ().matrix_value ()); - Matrix zmticks = xform.zscale (props.get_zminortickvalues ().matrix_value ()); + Matrix zticks = m_xform.zscale (props.get_ztick ().matrix_value ()); + Matrix zmticks = m_xform.zscale (props.get_zminortickvalues ().matrix_value ()); bool do_zminortick = props.is_zminortick () && ! zticks.isempty (); string_vector zticklabels = props.get_zticklabel ().string_vector_value (); int wmax = 0; @@ -2175,9 +2176,9 @@ base_properties p = go.get_properties (); if (p.is_visible () - || (selecting && p.pickableparts_is ("all"))) + || (m_selecting && p.pickableparts_is ("all"))) { - if (go.isa ("light") && ! selecting) + if (go.isa ("light") && ! m_selecting) { if (m_current_light-GL_LIGHT0 < m_max_lights) { @@ -2187,9 +2188,9 @@ } } else if (go.isa ("hggroup") - && ! (selecting && p.pickableparts_is ("none"))) + && ! (m_selecting && p.pickableparts_is ("none"))) draw_all_lights (go.get_properties (), obj_list); - else if (! (selecting && p.pickableparts_is ("none"))) + else if (! (m_selecting && p.pickableparts_is ("none"))) obj_list.push_back (go); } } @@ -2240,7 +2241,7 @@ // save camera position and set ambient light color before drawing // other objects - view_vector = props.get_cameraposition ().matrix_value (); + m_view_vector = props.get_cameraposition ().matrix_value (); float cb[4] = { 1.0, 1.0, 1.0, 1.0 }; ColumnVector ambient_color = props.get_ambientlightcolor_rgb (); @@ -2308,7 +2309,7 @@ // Don't draw the axes and its children if we are in selection and // pickable parts is "none". - if (selecting && props.pickableparts_is ("none")) + if (m_selecting && props.pickableparts_is ("none")) return; static double floatmax = std::numeric_limits<float>::max (); @@ -2374,11 +2375,11 @@ { #if defined (HAVE_OPENGL) - bool draw_all = selecting && props.pickableparts_is ("all"); - - Matrix x = xform.xscale (props.get_xdata ().matrix_value ()); - Matrix y = xform.yscale (props.get_ydata ().matrix_value ()); - Matrix z = xform.zscale (props.get_zdata ().matrix_value ()); + bool draw_all = m_selecting && props.pickableparts_is ("all"); + + Matrix x = m_xform.xscale (props.get_xdata ().matrix_value ()); + Matrix y = m_xform.yscale (props.get_ydata ().matrix_value ()); + Matrix z = m_xform.zscale (props.get_zdata ().matrix_value ()); bool has_z = (z.numel () > 0); int n = static_cast<int> (std::min (std::min (x.numel (), y.numel ()), @@ -2394,7 +2395,7 @@ clip[i] = (clip_code (x(i), y(i), z(i)) & clip_mask); else { - double z_mid = (zmin+zmax)/2; + double z_mid = (m_zmin+m_zmax)/2; for (int i = 0; i < n; i++) clip[i] = (clip_code (x(i), y(i), z_mid) & clip_mask); @@ -2520,11 +2521,11 @@ { #if defined (HAVE_OPENGL) - bool draw_all = selecting && props.pickableparts_is ("all"); - - const Matrix x = xform.xscale (props.get_xdata ().matrix_value ()); - const Matrix y = xform.yscale (props.get_ydata ().matrix_value ()); - const Matrix z = xform.zscale (props.get_zdata ().matrix_value ()); + bool draw_all = m_selecting && props.pickableparts_is ("all"); + + const Matrix x = m_xform.xscale (props.get_xdata ().matrix_value ()); + const Matrix y = m_xform.yscale (props.get_ydata ().matrix_value ()); + const Matrix z = m_xform.zscale (props.get_zdata ().matrix_value ()); int zr = z.rows (); int zc = z.columns (); @@ -3177,9 +3178,9 @@ return; } - bool draw_all = selecting && props.pickableparts_is ("all"); + bool draw_all = m_selecting && props.pickableparts_is ("all"); const Matrix f = props.get_faces ().matrix_value (); - const Matrix v = xform.scale (props.get_vertices ().matrix_value ()); + const Matrix v = m_xform.scale (props.get_vertices ().matrix_value ()); Matrix c; Matrix a; double fa = 1.0; @@ -3308,9 +3309,9 @@ { double dir = 1.0; if (bfl_mode > 0) - dir = ((fn(i,0) * view_vector(0) - + fn(i,1) * view_vector(1) - + fn(i,2) * view_vector(2) < 0) + dir = ((fn(i,0) * m_view_vector(0) + + fn(i,1) * m_view_vector(1) + + fn(i,2) * m_view_vector(2) < 0) ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); fnn(0) = dir * fn(i,0); fnn(1) = dir * fn(i,1); @@ -3320,9 +3321,9 @@ { double dir = 1.0; if (bfl_mode > 0) - dir = ((vn(idx,0) * view_vector(0) - + vn(idx,1) * view_vector(1) - + vn(idx,2) * view_vector(2) < 0) + dir = ((vn(idx,0) * m_view_vector(0) + + vn(idx,1) * m_view_vector(1) + + vn(idx,2) * m_view_vector(2) < 0) ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); vnn(0) = dir * vn(idx,0); vnn(1) = dir * vn(idx,1); @@ -3716,7 +3717,7 @@ return; } - bool draw_all = selecting; + bool draw_all = m_selecting; if (draw_all || (! props.marker_is ("none") && ! (props.markeredgecolor_is ("none") @@ -3866,7 +3867,7 @@ m_glfcns.glLoadIdentity (); Matrix vp = get_viewport_scaled (); - m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2); + m_glfcns.glOrtho (0, vp(2), vp(3), 0, m_xZ1, m_xZ2); m_glfcns.glMatrixMode (GL_MODELVIEW); m_glfcns.glPushMatrix (); m_glfcns.glLoadIdentity (); @@ -3910,7 +3911,7 @@ if (props.get_string ().isempty () || props.color_is ("none")) return; - Matrix pos = xform.scale (props.get_data_position ()); + Matrix pos = m_xform.scale (props.get_data_position ()); // Handle clipping manually when drawing text in ortho coordinates if (! props.is_clipping () @@ -4204,7 +4205,7 @@ m_glfcns.glColor3dv (c.data ()); if (! c.isempty ()) - txt_renderer.set_color (c); + m_txt_renderer.set_color (c); #else @@ -4222,12 +4223,12 @@ opengl_renderer::set_font (const base_properties& props) { bool do_anti_alias = props.get ("fontsmoothing").string_value () == "on"; - txt_renderer.set_anti_aliasing (do_anti_alias); - txt_renderer.set_font (props.get ("fontname").string_value (), - props.get ("fontweight").string_value (), - props.get ("fontangle").string_value (), - props.get ("__fontsize_points__").double_value () - * m_devpixratio); + m_txt_renderer.set_anti_aliasing (do_anti_alias); + m_txt_renderer.set_font (props.get ("fontname").string_value (), + props.get ("fontweight").string_value (), + props.get ("fontangle").string_value (), + props.get ("__fontsize_points__").double_value () + * m_devpixratio); } void @@ -4369,9 +4370,9 @@ p(2) = 1; p(3) = -z1; m_glfcns.glClipPlane (GL_CLIP_PLANE5, p.data ()); - xmin = x1; xmax = x2; - ymin = y1; ymax = y2; - zmin = z1; zmax = z2; + m_xmin = x1; m_xmax = x2; + m_ymin = y1; m_ymax = y2; + m_zmin = z1; m_zmax = z2; #else @@ -4428,15 +4429,15 @@ m_glfcns.glLoadIdentity (); Matrix vp = get_viewport_scaled (); - m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2); + m_glfcns.glOrtho (0, vp(2), vp(3), 0, m_xZ1, m_xZ2); m_glfcns.glMatrixMode (GL_MODELVIEW); m_glfcns.glPushMatrix (); set_clipping (false); set_linewidth (width); - marker_id = make_marker_list (m, size, false); - filled_marker_id = make_marker_list (m, size, true); + m_marker_id = make_marker_list (m, size, false); + m_filled_marker_id = make_marker_list (m, size, true); #else @@ -4457,8 +4458,8 @@ { #if defined (HAVE_OPENGL) - marker_id = make_marker_list (m, size, false); - filled_marker_id = make_marker_list (m, size, true); + m_marker_id = make_marker_list (m, size, false); + m_filled_marker_id = make_marker_list (m, size, true); #else @@ -4478,8 +4479,8 @@ { #if defined (HAVE_OPENGL) - m_glfcns.glDeleteLists (marker_id, 1); - m_glfcns.glDeleteLists (filled_marker_id, 1); + m_glfcns.glDeleteLists (m_marker_id, 1); + m_glfcns.glDeleteLists (m_filled_marker_id, 1); m_glfcns.glMatrixMode (GL_MODELVIEW); m_glfcns.glPopMatrix (); @@ -4504,31 +4505,31 @@ { #if defined (HAVE_OPENGL) - ColumnVector tmp = xform.transform (x, y, z, false); + ColumnVector tmp = m_xform.transform (x, y, z, false); m_glfcns.glLoadIdentity (); m_glfcns.glTranslated (tmp(0), tmp(1), -tmp(2)); - if (filled_marker_id > 0 && fc.numel () > 0) + if (m_filled_marker_id > 0 && fc.numel () > 0) { m_glfcns.glColor4d (fc(0), fc(1), fc(2), fa); set_polygon_offset (true, -1.0); - m_glfcns.glCallList (filled_marker_id); + m_glfcns.glCallList (m_filled_marker_id); if (lc.numel () > 0) { m_glfcns.glColor4d (lc(0), lc(1), lc(2), la); m_glfcns.glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); m_glfcns.glEdgeFlag (GL_TRUE); set_polygon_offset (true, -2.0); - m_glfcns.glCallList (filled_marker_id); + m_glfcns.glCallList (m_filled_marker_id); m_glfcns.glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); } set_polygon_offset (false); } - else if (marker_id > 0 && lc.numel () > 0) + else if (m_marker_id > 0 && lc.numel () > 0) { m_glfcns.glColor4d (lc(0), lc(1), lc(2), la); - m_glfcns.glCallList (marker_id); + m_glfcns.glCallList (m_marker_id); } #else @@ -4614,7 +4615,7 @@ double dir = 1.0; if (bfl_mode > 0) - dir = ((x * view_vector(0) + y * view_vector(1) + z * view_vector(2) < 0) + dir = ((x * m_view_vector(0) + y * m_view_vector(1) + z * m_view_vector(2) < 0) ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); m_glfcns.glNormal3d (dir*x/d, dir*y/d, dir*z/d); @@ -4841,8 +4842,8 @@ Matrix& bbox, int halign, int valign, double rotation) { - txt_renderer.text_to_pixels (txt, pixels, bbox, halign, valign, - rotation, interpreter); + m_txt_renderer.text_to_pixels (txt, pixels, bbox, halign, valign, + rotation, m_interpreter); } void @@ -4851,8 +4852,8 @@ Matrix& bbox, int halign, int valign, double rotation) { - txt_renderer.text_to_strlist (txt, lst, bbox, halign, valign, - rotation, interpreter); + m_txt_renderer.text_to_strlist (txt, lst, bbox, halign, valign, + rotation, m_interpreter); } Matrix @@ -4867,7 +4868,7 @@ if (txt.empty ()) return bbox; - if (txt_renderer.ok ()) + if (m_txt_renderer.ok ()) { uint8NDArray pixels; text_to_pixels (txt, pixels, bbox, halign, valign, rotation);
--- a/libinterp/corefcn/gl-render.h Thu Jul 15 10:16:37 2021 +0200 +++ b/libinterp/corefcn/gl-render.h Thu Jul 15 16:11:12 2021 -0400 @@ -63,7 +63,7 @@ virtual void set_viewport (int w, int h); virtual void set_device_pixel_ratio (double dpr) { m_devpixratio = dpr; } virtual Matrix get_viewport_scaled (void) const; - virtual graphics_xform get_transform (void) const { return xform; } + virtual graphics_xform get_transform (void) const { return m_xform; } virtual uint8NDArray get_pixels (int width, int height); virtual void draw_zoom_box (int width, int height, @@ -102,7 +102,7 @@ virtual void set_color (const Matrix& c); virtual void set_interpreter (const caseless_str& interp) { - interpreter = interp; + m_interpreter = interp; } virtual void set_linewidth (float w); virtual void set_linestyle (const std::string& s, bool stipple = false, @@ -112,7 +112,7 @@ virtual void set_polygon_offset (bool on, float offset = 0.0f); virtual void set_selecting (bool on) { - selecting = on; + m_selecting = on; } virtual void init_marker (const std::string& m, double size, float width); @@ -175,12 +175,12 @@ uint8_t clip_code (double x, double y, double z) const { - return ((x < xmin ? 1 : 0) - | (x > xmax ? 1 : 0) << 1 - | (y < ymin ? 1 : 0) << 2 - | (y > ymax ? 1 : 0) << 3 - | (z < zmin ? 1 : 0) << 4 - | (z > zmax ? 1 : 0) << 5 + return ((x < m_xmin ? 1 : 0) + | (x > m_xmax ? 1 : 0) << 1 + | (y < m_ymin ? 1 : 0) << 2 + | (y > m_ymax ? 1 : 0) << 3 + | (z < m_zmin ? 1 : 0) << 4 + | (z > m_zmax ? 1 : 0) << 5 | (is_nan_or_inf (x, y, z) ? 0 : 1) << 6); } @@ -219,41 +219,41 @@ opengl_functions& m_glfcns; // axis limits in model scaled coordinate - double xmin, xmax; - double ymin, ymax; - double zmin, zmax; + double m_xmin, m_xmax; + double m_ymin, m_ymax; + double m_zmin, m_zmax; // Factor used for translating Octave pixels to actual device pixels double m_devpixratio; // axes transformation data - graphics_xform xform; + graphics_xform m_xform; private: - // The graphics toolkit associated with the figure being rendered. - graphics_toolkit toolkit; + // The graphics m_toolkit associated with the figure being rendered. + graphics_toolkit m_toolkit; // Z projection limits in windows coordinate - double xZ1, xZ2; + double m_xZ1, m_xZ2; // call lists identifiers for markers - unsigned int marker_id, filled_marker_id; + unsigned int m_marker_id, m_filled_marker_id; // camera information for primitive sorting and lighting - ColumnVector camera_pos, camera_dir, view_vector; + ColumnVector m_camera_pos, m_camera_dir, m_view_vector; // interpreter to be used by text_to_pixels - caseless_str interpreter; + caseless_str m_interpreter; - text_renderer txt_renderer; + text_renderer m_txt_renderer; // light object present and visible unsigned int m_current_light; unsigned int m_max_lights; // Indicate we are drawing for selection purpose - bool selecting; + bool m_selecting; // Indicate we are drawing for printing purpose bool m_printing;
--- a/libinterp/corefcn/gl2ps-print.cc Thu Jul 15 10:16:37 2021 +0200 +++ b/libinterp/corefcn/gl2ps-print.cc Thu Jul 15 16:11:12 2021 -0400 @@ -64,8 +64,8 @@ gl2ps_renderer (opengl_functions& glfcns, FILE *_fp, const std::string& _term) - : opengl_renderer (glfcns), fp (_fp), term (_term), fontsize (), - fontname (), buffer_overflow (false), m_svg_def_index (0) + : opengl_renderer (glfcns), m_fp (_fp), m_term (_term), m_fontsize (), + m_fontname (), m_buffer_overflow (false), m_svg_def_index (0) { } ~gl2ps_renderer (void) = default; @@ -165,7 +165,7 @@ else if (state == GL2PS_ERROR) error ("gl2ps_renderer::draw_axes: gl2psEndPage returned GL2PS_ERROR"); - buffer_overflow |= (state == GL2PS_OVERFLOW); + m_buffer_overflow |= (state == GL2PS_OVERFLOW); // Don't draw background for subsequent viewports (legends, subplots, // etc.) @@ -282,11 +282,11 @@ int alignment_to_mode (int ha, int va) const; - FILE *fp; - caseless_str term; - double fontsize; - std::string fontname; - bool buffer_overflow; + FILE *m_fp; + caseless_str m_term; + double m_fontsize; + std::string m_fontname; + bool m_buffer_overflow; std::size_t m_svg_def_index; }; @@ -338,24 +338,24 @@ in_draw = true; GLint gl2ps_term = GL2PS_PS; - if (term.find ("eps") != std::string::npos) + if (m_term.find ("eps") != std::string::npos) gl2ps_term = GL2PS_EPS; - else if (term.find ("pdf") != std::string::npos) + else if (m_term.find ("pdf") != std::string::npos) gl2ps_term = GL2PS_PDF; - else if (term.find ("ps") != std::string::npos) + else if (m_term.find ("ps") != std::string::npos) gl2ps_term = GL2PS_PS; - else if (term.find ("svg") != std::string::npos) + else if (m_term.find ("svg") != std::string::npos) gl2ps_term = GL2PS_SVG; - else if (term.find ("pgf") != std::string::npos) + else if (m_term.find ("pgf") != std::string::npos) gl2ps_term = GL2PS_PGF; - else if (term.find ("tex") != std::string::npos) + else if (m_term.find ("tex") != std::string::npos) gl2ps_term = GL2PS_TEX; else warning ("gl2ps_renderer::draw: Unknown terminal %s, using 'ps'", - term.c_str ()); + m_term.c_str ()); GLint gl2ps_text = 0; - if (term.find ("notxt") != std::string::npos) + if (m_term.find ("notxt") != std::string::npos) gl2ps_text = GL2PS_NO_TEXT; // Default sort order optimizes for 3D plots @@ -375,16 +375,16 @@ frame.add ([=] () { std::fclose (tmpf); }); // Reset buffsize, unless this is 2nd pass of a texstandalone print. - if (term.find ("tex") == std::string::npos) + if (m_term.find ("tex") == std::string::npos) buffsize = 2*1024*1024; else buffsize /= 2; - buffer_overflow = true; + m_buffer_overflow = true; - while (buffer_overflow) + while (m_buffer_overflow) { - buffer_overflow = false; + m_buffer_overflow = false; buffsize *= 2; std::fseek (tmpf, 0, SEEK_SET); @@ -448,10 +448,10 @@ opengl_renderer::draw (go); - if (buffer_overflow) + if (m_buffer_overflow) warning ("gl2ps_renderer::draw: retrying with buffer size: %.1E B\n", double (2*buffsize)); - if (! buffer_overflow) + if (! m_buffer_overflow) old_print_cmd = print_cmd; // Don't check return value of gl2psEndPage, it is not meaningful. @@ -469,8 +469,8 @@ // In EPS terminal read the header line by line and insert a // new procedure const char* fcn = "/SRX { gsave FCT moveto rotate xshow grestore } BD\n"; - bool header_found = ! (term.find ("eps") != std::string::npos - || term.find ("svg") != std::string::npos); + bool header_found = ! (m_term.find ("eps") != std::string::npos + || m_term.find ("svg") != std::string::npos); while (! feof (tmpf) && nread) { @@ -484,7 +484,7 @@ if (! header_found && std::strncmp (str, "/SBCR", 5) == 0) { header_found = true; - nwrite = std::fwrite (fcn, 1, strlen (fcn), fp); + nwrite = std::fwrite (fcn, 1, strlen (fcn), m_fp); if (nwrite != strlen (fcn)) { // FIXME: is this the best thing to do here? @@ -492,7 +492,7 @@ error ("gl2ps_renderer::draw: internal pipe error"); } } - else if (term.find ("svg") != std::string::npos) + else if (m_term.find ("svg") != std::string::npos) { // FIXME: gl2ps uses pixel units for SVG format. // Modify resulting svg to use points instead. @@ -515,7 +515,7 @@ } } - nwrite = std::fwrite (str, 1, nread, fp); + nwrite = std::fwrite (str, 1, nread, m_fp); if (nwrite != nread) { // FIXME: is this the best thing to do here? @@ -1061,14 +1061,14 @@ std::string str; if (txtobj.get_code ()) { - fontname = "Symbol"; + m_fontname = "Symbol"; str = code_to_symbol (txtobj.get_code ()); } else { - fontname = select_font (txtobj.get_name (), - txtobj.get_weight () == "bold", - txtobj.get_angle () == "italic"); + m_fontname = select_font (txtobj.get_name (), + txtobj.get_weight () == "bold", + txtobj.get_angle () == "italic"); // Check that the string is composed of single byte characters const std::string tmpstr = txtobj.get_string (); @@ -1126,7 +1126,7 @@ ss << "10] " << rotation << " " << txtobj.get_x () << " " << txtobj.get_y () << " " << txtobj.get_size () - << " /" << fontname << " SRX\n"; + << " /" << m_fontname << " SRX\n"; } ss << "grestore\n"; @@ -1139,7 +1139,7 @@ double x, double y, double z, int ha, int va, double rotation) { - std::string saved_font = fontname; + std::string saved_font = m_fontname; if (txt.empty ()) return Matrix (1, 4, 0.0); @@ -1152,13 +1152,13 @@ m_glfcns.glRasterPos3d (x, y, z); // For svg/eps directly dump a preformated text element into gl2ps output - if (term.find ("svg") != std::string::npos) + if (m_term.find ("svg") != std::string::npos) { std::string elt = strlist_to_svg (x, y, z, bbox, rotation, lst); if (! elt.empty ()) gl2psSpecial (GL2PS_SVG, elt.c_str ()); } - else if (term.find ("eps") != std::string::npos) + else if (m_term.find ("eps") != std::string::npos) { std::string elt = strlist_to_ps (x, y, z, bbox, rotation, lst); if (! elt.empty ()) @@ -1166,10 +1166,10 @@ } else - gl2psTextOpt (str.c_str (), fontname.c_str (), fontsize, + gl2psTextOpt (str.c_str (), m_fontname.c_str (), m_fontsize, alignment_to_mode (ha, va), rotation); - fontname = saved_font; + m_fontname = saved_font; return bbox; } @@ -1183,7 +1183,7 @@ if (props.has_property ("interpreter")) set_interpreter (props.get ("interpreter").string_value ()); - fontsize = props.get ("__fontsize_points__").double_value (); + m_fontsize = props.get ("__fontsize_points__").double_value (); caseless_str fn = props.get ("fontname").xtolower ().string_value (); bool isbold @@ -1191,7 +1191,7 @@ bool isitalic = (props.get ("fontangle").xtolower ().string_value () == "italic"); - fontname = select_font (fn, isbold, isitalic); + m_fontname = select_font (fn, isbold, isitalic); } void @@ -1229,8 +1229,8 @@ y(1) = y(1) + (h-1); - const ColumnVector p0 = xform.transform (x(0), y(0), 0); - const ColumnVector p1 = xform.transform (x(1), y(1), 0); + const ColumnVector p0 = m_xform.transform (x(0), y(0), 0); + const ColumnVector p1 = m_xform.transform (x(1), y(1), 0); if (math::isnan (p0(0)) || math::isnan (p0(1)) || math::isnan (p1(0)) || math::isnan (p1(1))) @@ -1251,7 +1251,7 @@ } else { - const ColumnVector p1w = xform.transform (x(1) + 1, y(1), 0); + const ColumnVector p1w = m_xform.transform (x(1) + 1, y(1), 0); pix_dx = p1w(0) - p0(0); nor_dx = 1; } @@ -1263,7 +1263,7 @@ } else { - const ColumnVector p1h = xform.transform (x(1), y(1) + 1, 0); + const ColumnVector p1h = m_xform.transform (x(1), y(1) + 1, 0); pix_dy = p1h(1) - p0(1); nor_dy = 1; } @@ -1285,9 +1285,9 @@ Matrix vp = get_viewport_scaled (); ColumnVector vp_lim_min - = xform.untransform (std::numeric_limits <float>::epsilon (), + = m_xform.untransform (std::numeric_limits <float>::epsilon (), std::numeric_limits <float>::epsilon ()); - ColumnVector vp_lim_max = xform.untransform (vp(2), vp(3)); + ColumnVector vp_lim_max = m_xform.untransform (vp(2), vp(3)); if (vp_lim_min(0) > vp_lim_max(0)) std::swap (vp_lim_min(0), vp_lim_max(0)); @@ -1296,16 +1296,16 @@ std::swap (vp_lim_min(1), vp_lim_max(1)); float clip_xmin - = do_clip ? (vp_lim_min(0) > xmin ? vp_lim_min(0) : xmin) : vp_lim_min(0); + = do_clip ? (vp_lim_min(0) > m_xmin ? vp_lim_min(0) : m_xmin) : vp_lim_min(0); float clip_ymin - = do_clip ? (vp_lim_min(1) > ymin ? vp_lim_min(1) : ymin) : vp_lim_min(1); + = do_clip ? (vp_lim_min(1) > m_ymin ? vp_lim_min(1) : m_ymin) : vp_lim_min(1); float clip_xmax - = do_clip ? (vp_lim_max(0) < xmax ? vp_lim_max(0) : xmax) : vp_lim_max(0); + = do_clip ? (vp_lim_max(0) < m_xmax ? vp_lim_max(0) : m_xmax) : vp_lim_max(0); float clip_ymax - = do_clip ? (vp_lim_max(1) < ymax ? vp_lim_max(1) : ymax) : vp_lim_max(1); + = do_clip ? (vp_lim_max(1) < m_ymax ? vp_lim_max(1) : m_ymax) : vp_lim_max(1); if (im_xmin < clip_xmin) j0 += (clip_xmin - im_xmin)/nor_dx + 1; @@ -1513,7 +1513,7 @@ set_font (props); set_color (props.get_color_rgb ()); - std::string saved_font = fontname; + std::string saved_font = m_fontname; // Alignment int halign = 0; @@ -1560,7 +1560,7 @@ bool have_cmd = stream.length () > 1 && stream[0] == '|'; - FILE *fp = nullptr; + FILE *m_fp = nullptr; unwind_protect frame; @@ -1570,27 +1570,27 @@ std::string cmd = stream.substr (1); - fp = popen (cmd.c_str (), "w"); + m_fp = popen (cmd.c_str (), "w"); - if (! fp) + if (! m_fp) error (R"(print: failed to open pipe "%s")", stream.c_str ()); // Need octave:: qualifier here to avoid ambiguity. - frame.add ([=] () { octave::pclose (fp); }); + frame.add ([=] () { octave::pclose (m_fp); }); } else { // Write gl2ps output directly to file. - fp = sys::fopen (stream.c_str (), "w"); + m_fp = sys::fopen (stream.c_str (), "w"); - if (! fp) + if (! m_fp) error (R"(gl2ps_print: failed to create file "%s")", stream.c_str ()); - frame.add ([=] () { std::fclose (fp); }); + frame.add ([=] () { std::fclose (m_fp); }); } - gl2ps_renderer rend (glfcns, fp, term); + gl2ps_renderer rend (glfcns, m_fp, term); Matrix pos = fig.get ("position").matrix_value (); rend.set_viewport (pos(2), pos(3));