[wxruby-users] Tearing in my buffered animation test script...

Mario Steele
Sat, 01 Dec 2007 13:30:30 -0000

On 11/30/07, Jay McGavren <jay at mcgavren.com>
wrote:
>
> OK, I have a basic blit demo working (thanks to Alex Fenton for his
> reply, which I finally saw).
>
> However, there''s a great deal of "tearing" on the screen
- flickering
> grey lines in the black background.  It looks like the blit isn''t
> always complete when the screen refreshes.
>
> Can anyone look at this and tell me what I might be doing wrong?  Any
> help would be most appreciated!
>
> -Jay McGavren
> http://jay.mcgavren.com/zyps
> <snip>


Hey Jay,

I''ve actually looked over the demo, and tested it out on my computer.
According to what I see here, there should be no problems with it.  And
I''ve
tested it on Linux, and I have no flickering, or tears in it.  I would
suggest, for the final "blit" operation, that instead of waiting for a
Paint
Event, you switch to using DC#draw_bitmap()  instead of using DC#blit()
This will take a lot of the computation off of wxRuby, which it must do to
ensure that everything is within bounds, and there is not a programmer error
(Which is often raised by a Message box error, or a segfault).  Especially
considering that your drawing the entire buffer that you have offscreen.

Two other things.
1.) If your doing the actual painting when evt_paint() is called, then you
do not need to create a ClientDC  (Which is what window.paint does)
2.) You can skip evt_paint() and window.refresh/window.update all together,
and just call window.paint, to paint to the window, when your finished with
the painting on the Buffer.

Just a couple of suggestions for ya, which should take care of the flicker
and tearing.

Mario Steele
-------------- next part --------------
An HTML attachment was scrubbed...