bug in qtagg backend when blitting

Hello,
Attached is a script that when run from ipython --pylab with your
backend setup for 'QtAgg' reproduces a bug I am seeing. If you run the
plot, you'll see a line plotted in blue as expected. Then when the
same figure is updated by blitting, the line turns red. I tried this
with green and it stayed green, but yellow went to cyan. It seems that
the byteswapping that is necessary for displaying colors correctly in
Qt is happening during a normal plot, but not when blitting. I tried
going through the code to determine the problem, I can only guess that
it lies somewhere in the FigureCanvasQTAgg.paintEvent, since that's
where I see to_ARGB etc.
Sorry I couldn't locate the bug precisely, I find it very difficult to
thread my way through all the backend classes.
Glenn

bugdemo.py (359 Bytes)

I did track down the source of the bug a while back:
http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.30565.darren.dale%40cornell.edu

Mike D. suggested that BufferRegion might need a byte-swapped version of
to_string(), but unfortunately I am not an experienced c programmer and am
short of time to try to work my way through it right now. I added a bug
report at SF.

Darren

···

On Monday 05 May 2008 09:24:42 pm G Jones wrote:

Hello,
Attached is a script that when run from ipython --pylab with your
backend setup for 'QtAgg' reproduces a bug I am seeing. If you run the
plot, you'll see a line plotted in blue as expected. Then when the
same figure is updated by blitting, the line turns red. I tried this
with green and it stayed green, but yellow went to cyan. It seems that
the byteswapping that is necessary for displaying colors correctly in
Qt is happening during a normal plot, but not when blitting. I tried
going through the code to determine the problem, I can only guess that
it lies somewhere in the FigureCanvasQTAgg.paintEvent, since that's
where I see to_ARGB etc.
Sorry I couldn't locate the bug precisely, I find it very difficult to
thread my way through all the backend classes.

I'll go ahead and fix this. It just fell through the cracks.

Mike

Darren Dale wrote:

···

On Monday 05 May 2008 09:24:42 pm G Jones wrote:
  

Hello,
Attached is a script that when run from ipython --pylab with your
backend setup for 'QtAgg' reproduces a bug I am seeing. If you run the
plot, you'll see a line plotted in blue as expected. Then when the
same figure is updated by blitting, the line turns red. I tried this
with green and it stayed green, but yellow went to cyan. It seems that
the byteswapping that is necessary for displaying colors correctly in
Qt is happening during a normal plot, but not when blitting. I tried
going through the code to determine the problem, I can only guess that
it lies somewhere in the FigureCanvasQTAgg.paintEvent, since that's
where I see to_ARGB etc.
Sorry I couldn't locate the bug precisely, I find it very difficult to
thread my way through all the backend classes.
    
I did track down the source of the bug a while back: http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.30565.darren.dale%40cornell.edu

Mike D. suggested that BufferRegion might need a byte-swapped version of to_string(), but unfortunately I am not an experienced c programmer and am short of time to try to work my way through it right now. I added a bug report at SF.

Darren

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

This is now implemented on the branch and the trunk. Please let me know how it works for you. I'm particularly interested in non-Linux and Big Endian platforms (e.g. PPC) as a sanity check.

Cheers,
Mike

Michael Droettboom wrote:

···

I'll go ahead and fix this. It just fell through the cracks.

Mike

Darren Dale wrote:
  

On Monday 05 May 2008 09:24:42 pm G Jones wrote:
  

Hello,
Attached is a script that when run from ipython --pylab with your
backend setup for 'QtAgg' reproduces a bug I am seeing. If you run the
plot, you'll see a line plotted in blue as expected. Then when the
same figure is updated by blitting, the line turns red. I tried this
with green and it stayed green, but yellow went to cyan. It seems that
the byteswapping that is necessary for displaying colors correctly in
Qt is happening during a normal plot, but not when blitting. I tried
going through the code to determine the problem, I can only guess that
it lies somewhere in the FigureCanvasQTAgg.paintEvent, since that's
where I see to_ARGB etc.
Sorry I couldn't locate the bug precisely, I find it very difficult to
thread my way through all the backend classes.
    

I did track down the source of the bug a while back: http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.30565.darren.dale%40cornell.edu

Mike D. suggested that BufferRegion might need a byte-swapped version of to_string(), but unfortunately I am not an experienced c programmer and am short of time to try to work my way through it right now. I added a bug report at SF.

Darren

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

I'm testing it out on 64-bit linux with this script:

from pylab import *
from matplotlib.widgets import Cursor

ax=axes()
cursor = Cursor(ax, useblit=True)
ax.imshow(array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]), cmap=cm.jet,
interpolation='nearest')
show()

When the mouse pointer enters the axes, the cursor is drawn, blitting occurs,
along with wierdness. I'm attaching screenshots, one using the new
to_string_argb and one using to_string.

Darren

···

On Tuesday 06 May 2008 11:43:50 am Michael Droettboom wrote:

This is now implemented on the branch and the trunk. Please let me know
how it works for you. I'm particularly interested in non-Linux and Big
Endian platforms (e.g. PPC) as a sanity check.

Cheers,
Mike

Michael Droettboom wrote:
> I'll go ahead and fix this. It just fell through the cracks.
>
> Mike
>
> Darren Dale wrote:
>> On Monday 05 May 2008 09:24:42 pm G Jones wrote:
>>> Hello,
>>> Attached is a script that when run from ipython --pylab with your
>>> backend setup for 'QtAgg' reproduces a bug I am seeing. If you run the
>>> plot, you'll see a line plotted in blue as expected. Then when the
>>> same figure is updated by blitting, the line turns red. I tried this
>>> with green and it stayed green, but yellow went to cyan. It seems that
>>> the byteswapping that is necessary for displaying colors correctly in
>>> Qt is happening during a normal plot, but not when blitting. I tried
>>> going through the code to determine the problem, I can only guess that
>>> it lies somewhere in the FigureCanvasQTAgg.paintEvent, since that's
>>> where I see to_ARGB etc.
>>> Sorry I couldn't locate the bug precisely, I find it very difficult to
>>> thread my way through all the backend classes.
>>
>> I did track down the source of the bug a while back:
>> http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.30565
>>.darren.dale%40cornell.edu
>>
>> Mike D. suggested that BufferRegion might need a byte-swapped version of
>> to_string(), but unfortunately I am not an experienced c programmer and
>> am short of time to try to work my way through it right now. I added a
>> bug report at SF.
>>
>> Darren

Thanks. Try again now. Hopefully it's correct this time (your test is a much better unit test than the animation_blit_* examples.

Cheers,
Mike

Darren Dale wrote:

···

I'm testing it out on 64-bit linux with this script:

from pylab import *
from matplotlib.widgets import Cursor

ax=axes()
cursor = Cursor(ax, useblit=True)
ax.imshow(array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]), cmap=cm.jet, interpolation='nearest')
show()

When the mouse pointer enters the axes, the cursor is drawn, blitting occurs, along with wierdness. I'm attaching screenshots, one using the new to_string_argb and one using to_string.

Darren

On Tuesday 06 May 2008 11:43:50 am Michael Droettboom wrote:
  

This is now implemented on the branch and the trunk. Please let me know
how it works for you. I'm particularly interested in non-Linux and Big
Endian platforms (e.g. PPC) as a sanity check.

Cheers,
Mike

Michael Droettboom wrote:
    

I'll go ahead and fix this. It just fell through the cracks.

Mike

Darren Dale wrote:
      

On Monday 05 May 2008 09:24:42 pm G Jones wrote:
        

Hello,
Attached is a script that when run from ipython --pylab with your
backend setup for 'QtAgg' reproduces a bug I am seeing. If you run the
plot, you'll see a line plotted in blue as expected. Then when the
same figure is updated by blitting, the line turns red. I tried this
with green and it stayed green, but yellow went to cyan. It seems that
the byteswapping that is necessary for displaying colors correctly in
Qt is happening during a normal plot, but not when blitting. I tried
going through the code to determine the problem, I can only guess that
it lies somewhere in the FigureCanvasQTAgg.paintEvent, since that's
where I see to_ARGB etc.
Sorry I couldn't locate the bug precisely, I find it very difficult to
thread my way through all the backend classes.
          

I did track down the source of the bug a while back:
http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.30565
.darren.dale%40cornell.edu

Mike D. suggested that BufferRegion might need a byte-swapped version of
to_string(), but unfortunately I am not an experienced c programmer and
am short of time to try to work my way through it right now. I added a
bug report at SF.

Darren
        
------------------------------------------------------------------------

------------------------------------------------------------------------

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

There it is. Thanks Mike, it looks great on 64-bit Linux!

···

On Tuesday 06 May 2008 03:04:05 pm Michael Droettboom wrote:

Thanks. Try again now. Hopefully it's correct this time (your test is
a much better unit test than the animation_blit_* examples.

Cheers,
Mike

Darren Dale wrote:
> I'm testing it out on 64-bit linux with this script:
>
> from pylab import *
> from matplotlib.widgets import Cursor
>
> ax=axes()
> cursor = Cursor(ax, useblit=True)
> ax.imshow(array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]), cmap=cm.jet,
> interpolation='nearest')
> show()
>
> When the mouse pointer enters the axes, the cursor is drawn, blitting
> occurs, along with wierdness. I'm attaching screenshots, one using the
> new to_string_argb and one using to_string.
>
> Darren
>
> On Tuesday 06 May 2008 11:43:50 am Michael Droettboom wrote:
>> This is now implemented on the branch and the trunk. Please let me know
>> how it works for you. I'm particularly interested in non-Linux and Big
>> Endian platforms (e.g. PPC) as a sanity check.
>>
>> Cheers,
>> Mike
>>
>> Michael Droettboom wrote:
>>> I'll go ahead and fix this. It just fell through the cracks.
>>>
>>> Mike
>>>
>>> Darren Dale wrote:
>>>> On Monday 05 May 2008 09:24:42 pm G Jones wrote:
>>>>> Hello,
>>>>> Attached is a script that when run from ipython --pylab with your
>>>>> backend setup for 'QtAgg' reproduces a bug I am seeing. If you run
>>>>> the plot, you'll see a line plotted in blue as expected. Then when
>>>>> the same figure is updated by blitting, the line turns red. I tried
>>>>> this with green and it stayed green, but yellow went to cyan. It
>>>>> seems that the byteswapping that is necessary for displaying colors
>>>>> correctly in Qt is happening during a normal plot, but not when
>>>>> blitting. I tried going through the code to determine the problem, I
>>>>> can only guess that it lies somewhere in the
>>>>> FigureCanvasQTAgg.paintEvent, since that's where I see to_ARGB etc.
>>>>> Sorry I couldn't locate the bug precisely, I find it very difficult
>>>>> to thread my way through all the backend classes.
>>>>
>>>> I did track down the source of the bug a while back:
>>>> http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.305
>>>>65 .darren.dale%40cornell.edu
>>>>
>>>> Mike D. suggested that BufferRegion might need a byte-swapped version
>>>> of to_string(), but unfortunately I am not an experienced c programmer
>>>> and am short of time to try to work my way through it right now. I
>>>> added a bug report at SF.
>>>>
>>>> Darren

Great!

Cheers,
Mike

Darren Dale wrote:

···

There it is. Thanks Mike, it looks great on 64-bit Linux!

On Tuesday 06 May 2008 03:04:05 pm Michael Droettboom wrote:
  

Thanks. Try again now. Hopefully it's correct this time (your test is
a much better unit test than the animation_blit_* examples.

Cheers,
Mike

Darren Dale wrote:
    

I'm testing it out on 64-bit linux with this script:

from pylab import *
from matplotlib.widgets import Cursor

ax=axes()
cursor = Cursor(ax, useblit=True)
ax.imshow(array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]), cmap=cm.jet,
interpolation='nearest')
show()

When the mouse pointer enters the axes, the cursor is drawn, blitting
occurs, along with wierdness. I'm attaching screenshots, one using the
new to_string_argb and one using to_string.

Darren

On Tuesday 06 May 2008 11:43:50 am Michael Droettboom wrote:
      

This is now implemented on the branch and the trunk. Please let me know
how it works for you. I'm particularly interested in non-Linux and Big
Endian platforms (e.g. PPC) as a sanity check.

Cheers,
Mike

Michael Droettboom wrote:
        

I'll go ahead and fix this. It just fell through the cracks.

Mike

Darren Dale wrote:
          

On Monday 05 May 2008 09:24:42 pm G Jones wrote:
            

Hello,
Attached is a script that when run from ipython --pylab with your
backend setup for 'QtAgg' reproduces a bug I am seeing. If you run
the plot, you'll see a line plotted in blue as expected. Then when
the same figure is updated by blitting, the line turns red. I tried
this with green and it stayed green, but yellow went to cyan. It
seems that the byteswapping that is necessary for displaying colors
correctly in Qt is happening during a normal plot, but not when
blitting. I tried going through the code to determine the problem, I
can only guess that it lies somewhere in the
FigureCanvasQTAgg.paintEvent, since that's where I see to_ARGB etc.
Sorry I couldn't locate the bug precisely, I find it very difficult
to thread my way through all the backend classes.
              

I did track down the source of the bug a while back:
http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.305
65 .darren.dale%40cornell.edu

Mike D. suggested that BufferRegion might need a byte-swapped version
of to_string(), but unfortunately I am not an experienced c programmer
and am short of time to try to work my way through it right now. I
added a bug report at SF.

Darren
            
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA