bugGNU Octave - Bugs: bug #51374, hidden axis causes warning by...

 
 

bug #51374: hidden axis causes warning by print()

Submitter:  Marshall <marsian>
Submitted:  Mon 03 Jul 2017 05:47:07 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Marsian Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 01 Aug 2017 04:52:30 PM UTC, comment #4: 

I applied solution #1 on the development branch (http://hg.savannah.gnu.org/hgweb/octave/rev/784347c1b7e7).  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Tue 01 Aug 2017 04:05:51 PM UTC, comment #3: 

@Pantxo: Right, I forgot its August in Europe.  Enjoy your vacation.

Rik <rik5>
Group administrator
Tue 01 Aug 2017 02:06:08 PM UTC, comment #2: 

I am currently in vacations and I am unable to test. Don't expect a reply from me before 3 weeks or so, sorry.

Pantxo Diribarne <pantxo>
Group Member
Tue 01 Aug 2017 12:47:39 AM UTC, comment #1: 

@Pantxo: Could you take a look at this bug report?

The issue is in gl2ps_print.cc when the axes is not visible.  I have two different patches which both fix the issue, but maybe you know a reason to prefer one over the other?

The first patch skips the entire draw_axes function when the axes is invisble.  This one is probably better for performance.


diff -r d9ca3f15f739 libinterp/corefcn/gl2ps-print.cc
--- a/libinterp/corefcn/gl2ps-print.cc        Mon Jul 31 16:25:19 2017 -0700
+++ b/libinterp/corefcn/gl2ps-print.cc        Mon Jul 31 17:43:58 2017 -0700
@@ -96,6 +96,9 @@ namespace octave

     void draw_axes (const axes::properties& props)
     {
+      if (! props.is_visible ())
+        return;
+
       // Initialize a sorting tree (viewport) in gl2ps for each axes
       GLint vp[4];
       glGetIntegerv (GL_VIEWPORT, vp);


The second patch allows gl2ps to run through all the drawing routines, but simply disables the warning.


diff -r d9ca3f15f739 libinterp/corefcn/gl2ps-print.cc
--- a/libinterp/corefcn/gl2ps-print.cc        Mon Jul 31 16:25:19 2017 -0700
+++ b/libinterp/corefcn/gl2ps-print.cc        Mon Jul 31 17:37:05 2017 -0700
@@ -107,7 +107,7 @@ namespace octave

       // Finalize viewport
       GLint state = gl2psEndViewport ();
-      if (state == GL2PS_NO_FEEDBACK)
+      if (state == GL2PS_NO_FEEDBACK && props.is_visible ())
         warning ("gl2ps_renderer::draw_axes: empty feedback buffer and/or nothing else to print");
       else if (state == GL2PS_ERROR)
         error ("gl2ps_renderer::draw_axes: gl2psEndPage returned GL2PS_ERROR");


Both patches are attached to the report if you want to try them out.



(file #41379, file #41380)

Rik <rik5>
Group administrator
Mon 03 Jul 2017 05:47:07 PM UTC, original submission:  

I get the warning "gl2ps_renderer::draw_axes: empty feedback buffer and/or nothing else to print" when I run the following:


fig=figure
plot(rand(10,10),rand(10,10),';random;)
set(findall(fig,'tag','legend'),'visible','off')
print('test.png')


I trace the warning to drawnow (gl2ps_device{n}, ['|' pipeline{n}]); in _opengl_print_.m

The warning is because of the hidden axis. If it is visible, there is no warning. The work around is to delete the legend rather than just hide it. I would rather there just not be the warning, though I understand the purpose. I ran into this originally because I was printing a figure that had multiple sub-plots where I hid several redundant legends.

Marshall <marsian>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #41379:  print_warn1.diff added by rik5 (473B - text/x-patch)
file #41380:  print_warn2.diff added by rik5 (623B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by marsian (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-01 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-08-01 rik5 Attached File- Added print_warn1.diff, #41379
        Attached File- Added print_warn2.diff, #41380
        StatusNone Patch Submitted
        Operating SystemMicrosoft Windows Any
        Carbon-Copy- Added pantxo

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code