Mercurial > octave-nkf
comparison libinterp/corefcn/gl2ps-renderer.h @ 20645:395140e53656
Fix regression in svg output and simplify viewport handling (bug #44765)
* gl2ps-renderer.cc (glps-renderer::draw): remove check for GL2PS_NO_FEEDBACK, it it always true after EndViewport
* gl2ps-renderer.h (glps-renderer::draw_axes): call gl2psBegin(End)Viewport for every axes and check for GL2PS_NO_FEEDBACK after each axes.
* gl2ps-renderer.h (glps-renderer::draw_axes):remove unnecessary "naxes" attribute
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 12 Oct 2015 20:49:04 +0200 |
parents | d30fc2c11455 |
children |
comparison
equal
deleted
inserted
replaced
20644:4e307c55a2b5 | 20645:395140e53656 |
---|---|
35 glps_renderer : public opengl_renderer | 35 glps_renderer : public opengl_renderer |
36 { | 36 { |
37 public: | 37 public: |
38 glps_renderer (FILE *_fp, const std::string& _term) | 38 glps_renderer (FILE *_fp, const std::string& _term) |
39 : opengl_renderer () , fp (_fp), term (_term), fontsize (), | 39 : opengl_renderer () , fp (_fp), term (_term), fontsize (), |
40 fontname (), naxes (0) { } | 40 fontname () { } |
41 | 41 |
42 ~glps_renderer (void) { } | 42 ~glps_renderer (void) { } |
43 | 43 |
44 void draw (const graphics_object& go, const std::string& print_cmd); | 44 void draw (const graphics_object& go, const std::string& print_cmd); |
45 | 45 |
51 | 51 |
52 void set_font (const base_properties& props); | 52 void set_font (const base_properties& props); |
53 | 53 |
54 void draw_axes (const axes::properties& props) | 54 void draw_axes (const axes::properties& props) |
55 { | 55 { |
56 // Finish previous sorting tree here, the last one will be closed | 56 // Initialize a sorting tree (viewport) in gl2ps for each axes |
57 // by gl2psEndPage () | |
58 if (naxes++) | |
59 gl2psEndViewport (); | |
60 | |
61 // Initialize a sorting tree in gl2ps for each axes | |
62 GLint vp[4]; | 57 GLint vp[4]; |
63 glGetIntegerv (GL_VIEWPORT, vp); | 58 glGetIntegerv (GL_VIEWPORT, vp); |
64 gl2psBeginViewport (vp); | 59 gl2psBeginViewport (vp); |
65 | 60 |
66 // Draw and glFinish () or there may primitives missing in the | 61 // Draw and glFinish () or there may primitives missing in the |
67 // gl2ps output. | 62 // gl2ps output. |
68 opengl_renderer::draw_axes (props); | 63 opengl_renderer::draw_axes (props); |
69 glFinish (); | 64 glFinish (); |
65 | |
66 // Finalize viewport | |
67 GLint state = gl2psEndViewport (); | |
68 if (state == GL2PS_NO_FEEDBACK) | |
69 warning ("gl2ps-renderer::draw: empty feedback buffer and/or nothing else to print"); | |
70 } | 70 } |
71 | 71 |
72 void draw_text (const text::properties& props); | 72 void draw_text (const text::properties& props); |
73 void draw_pixels (GLsizei w, GLsizei h, GLenum format, | 73 void draw_pixels (GLsizei w, GLsizei h, GLenum format, |
74 GLenum type, const GLvoid *data); | 74 GLenum type, const GLvoid *data); |
106 int alignment_to_mode (int ha, int va) const; | 106 int alignment_to_mode (int ha, int va) const; |
107 FILE *fp; | 107 FILE *fp; |
108 caseless_str term; | 108 caseless_str term; |
109 double fontsize; | 109 double fontsize; |
110 std::string fontname; | 110 std::string fontname; |
111 int naxes; | |
112 }; | 111 }; |
113 | 112 |
114 #endif // HAVE_GL2PS_H | 113 #endif // HAVE_GL2PS_H |
115 | 114 |
116 extern OCTINTERP_API void | 115 extern OCTINTERP_API void |