bugGNU Octave - Bugs: bug #44567, Qt graphics toolkit displays twice...

 
 

bug #44567: Qt graphics toolkit displays twice when opening a new figure via plot or image.

Submitter:  Dan Sebald <sebald>
Submitted:  Wed 18 Mar 2015 07:06:28 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 19 Mar 2015 05:58:16 PM UTC, comment #4: 

The code in comment #3 works for me.  I don't get a doubly drawn figure.

Rik <rik5>
Group administrator
Thu 19 Mar 2015 05:59:06 AM UTC, comment #3: 

I just tried this example from https://savannah.gnu.org/bugs/?44526:


./run-octave -f --no-gui
graphics_toolkit qt
sombrero
graphics_toolkit (1, 'fltk')
graphics_toolkit (1, 'gnuplot')
graphics_toolkit (1, 'fltk')
# refresh() needed here


and the first time the sombrero appears there are back-to-back displays, once in 2D, then in 3D.

Maybe something has changed regarding holding off display inside a function until an appropriate time like pause().

Dan Sebald <sebald>
Thu 19 Mar 2015 05:40:13 AM UTC, comment #2: 

Much better.

The reason I thought it happened with plot as well is that I tried the example from bug https://savannah.gnu.org/bugs/?44564


A=diag(2*ones(19,1))+diag(-1*ones(18,1),-1)+diag(-1*ones(18,1),1);
spy(A)


and noticed that the plot is shown twice.  But that is because there is an axis() command that follows the plot:


  if (isnan (markersize))
    plot (j, i, line_spec);
  else
    plot (j, i, line_spec, "markersize", markersize);
  endif

  axis ([0, n+1, 0, m+1], "ij");


I tried changing the spy.m code so that there is only one draw, e.g., passing properties into plot(), placing axis() before plot().  Maybe changing a figure property so that drawing is not done immediately.  Couldn't find anything, but it sure seems like such a technique should be possible.

Dan Sebald <sebald>
Wed 18 Mar 2015 06:34:18 PM UTC, comment #1: 

The root cause is in image.m.


 h = __go_image__ (hax, "cdata", img, "xdata", xdata, "ydata", ydata,
                         "cdatamapping", "direct", varargin{:});

  if (do_new && ! ishold (hax))
    ## Set axis properties for new images

    if (! isempty (img))
      if (isscalar (get (hax, "children")))
        axis (hax, "tight");
      endif


The image is drawn by _go_image_ which apparently uses automatic scaling of the axes limits.  This is appropriate for ordinary data plots, but not for images where the axis should just contain the object.  So, the next thing the m-file does is apply 'axis (hax, "tight")', but only if it is a new figure (do_new).

Incidentally, I get a doubly drawn image with both the FLTK and Qt toolkits.

I pushed a cset to fix this http://hg.savannah.gnu.org/hgweb/octave/rev/2e7497ff2535.

Using test code:


tic; image(32*rand(5000,1000)); toc


I find the previous implementation took 3.4 second while the new one takes 0.6 seconds.

I didn't see any problems with other image demos so I don't think it impacted the correctness of the function.

Rik <rik5>
Group administrator
Wed 18 Mar 2015 07:06:28 AM UTC, original submission:  

When an integrated Qt plot() or image() is done, the display occurs twice when the figure window is created initiated by the command.  This does not happen in gnuplot or FLTK graphics toolkits.

Try the following after just starting Octave or making sure that all plot windows are closed:


image(32*rand(5000,1000))


and watch for the repeated display of the image--once as a smaller image then followed by the image at the correct size.

Try again with the plot window still open:


image(32*rand(5000,1000))


and the image only is displayed once.

Close all windows or exit and re-enter Octave.  Now try (individual commands with wait a between or copied simultaneous):


figure()
image(32*rand(5000,1000))


and the image only is drawn once.

Dan Sebald <sebald>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sebald (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-18 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code