# HG changeset patch # User John W. Eaton # Date 1296593744 18000 # Node ID 523c5bcc1a7652118f0edda239f7ebccce27c7da # Parent 6368c943c42cd6fa48169c757396df14865f16b4 avoid using new to create temporary gl2ps_renderer object diff -r 6368c943c42c -r 523c5bcc1a76 src/ChangeLog --- a/src/ChangeLog Tue Feb 01 15:42:07 2011 -0500 +++ b/src/ChangeLog Tue Feb 01 15:55:44 2011 -0500 @@ -1,3 +1,10 @@ +2011-02-01 John W. Eaton + + * gl2ps-renderer.h: Remove virtual tag for derived virtual functions. + (opengl_renderer (const graphics_handle&)): New function. + * DLD-FUNCTIONS/__init_fltk__.cc (OpenGL_fltk::Fl_Gl_Window): + Don't use new to create temporary glps_renderer object. + 2011-02-01 Michael Godfrey * gl2ps-renderer.cc (glps_renderer::draw): diff -r 6368c943c42c -r 523c5bcc1a76 src/DLD-FUNCTIONS/__init_fltk__.cc --- a/src/DLD-FUNCTIONS/__init_fltk__.cc Tue Feb 01 15:42:07 2011 -0500 +++ b/src/DLD-FUNCTIONS/__init_fltk__.cc Tue Feb 01 15:55:44 2011 -0500 @@ -153,12 +153,13 @@ setup_viewport (w (), h ()); } - if ( print_fid > 0 ) + if (print_fid > 0) { - opengl_renderer *rend = new glps_renderer (print_fid, print_term); - rend->draw (gh_manager::lookup (number)); + glps_renderer rend (print_fid, print_term); + + rend.draw (gh_manager::lookup (number)); + print_fid = -1; - delete rend; } else { diff -r 6368c943c42c -r 523c5bcc1a76 src/gl2ps-renderer.h --- a/src/gl2ps-renderer.h Tue Feb 01 15:42:07 2011 -0500 +++ b/src/gl2ps-renderer.h Tue Feb 01 15:55:44 2011 -0500 @@ -37,22 +37,27 @@ ~glps_renderer (void) { } - virtual void draw (const graphics_object& go); + void draw (const graphics_handle& h) + { + draw (gh_manager::get_object (h)); + } + + void draw (const graphics_object& go); protected: - virtual Matrix render_text (const std::string& txt, - double x, double y, double z, - int halign, int valign, double rotation = 0.0); + Matrix render_text (const std::string& txt, + double x, double y, double z, + int halign, int valign, double rotation = 0.0); - virtual void set_font (const base_properties& props); + void set_font (const base_properties& props); - virtual void draw_text (const text::properties& props); - virtual void draw_pixels (GLsizei w, GLsizei h, GLenum format, - GLenum type, const GLvoid *data); + void draw_text (const text::properties& props); + void draw_pixels (GLsizei w, GLsizei h, GLenum format, + GLenum type, const GLvoid *data); - virtual void set_linestyle (const std::string& s, bool use_stipple) + void set_linestyle (const std::string& s, bool use_stipple) { opengl_renderer::set_linestyle (s, use_stipple); if (use_stipple) @@ -61,7 +66,7 @@ gl2psDisable (GL2PS_LINE_STIPPLE); } - virtual void set_polygon_offset (bool on, double offset = 0.0) + void set_polygon_offset (bool on, double offset = 0.0) { opengl_renderer::set_polygon_offset (on, offset); if (on) @@ -70,7 +75,7 @@ gl2psDisable (GL2PS_POLYGON_OFFSET_FILL); } - virtual void set_linewidth (float w) + void set_linewidth (float w) { gl2psLineWidth (w); }