Mercurial > hg > octave-nkf
changeset 12360:523c5bcc1a76 release-3-4-x
avoid using new to create temporary gl2ps_renderer object
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 01 Feb 2011 15:55:44 -0500 |
parents | 6368c943c42c |
children | a950bfb7b8e8 |
files | src/ChangeLog src/DLD-FUNCTIONS/__init_fltk__.cc src/gl2ps-renderer.h |
diffstat | 3 files changed, 28 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-02-01 John W. Eaton <jwe@octave.org> + + * 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 <godfrey@isl.stanford.edu> * gl2ps-renderer.cc (glps_renderer::draw):
--- a/src/DLD-FUNCTIONS/__init_fltk__.cc +++ b/src/DLD-FUNCTIONS/__init_fltk__.cc @@ -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 {
--- a/src/gl2ps-renderer.h +++ b/src/gl2ps-renderer.h @@ -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); }