Yeah, the clipping in there now only clips objects if they are
completely off-screen so you can have lots of off-screen objects without
incurring too much overhead. If you have lots of objects on the screen
(even if many are not visible due to overdraw) then it slows down a lot.
However, even then the drawing speed is much faster than in Python and
comparable to using DrawXXXList functions. The problem with my demo and
high densities it that I issue a Refresh() every 50ms (or as fast as the
timer can run). If the re-draw time goes above 50ms then the events
stack up and it just draws over and over as fast as it can. If you
disable the timer or set the timer rate to say 200ms then it shouldn't
eat up the CPU constantly. I doubt anyone will actually use this for
animation. I was just trying to show that objects can be moved around
without being redrawn. I might see if I can think of something besides
animation to show the TranslateID. The easiest would be to allow the
user to drag things around but that requires the hit testing I haven't
written yet ![]()
I don't expect there is anything simple that can be done to make
high-overdraw situations faster. Any limitations at this point are due
to speed limits of using a wx.DC for drawing rather than overhead of
Python or PseudoDC. Something like an OpenGL dc with a wx.DC interface
could use a Z-buffer to limit overdraw and thus not draw stuff that is
covered up. Besides it would be much faster anyway due to better
hardware acceleration of openGL. Other then that, I'm not sure anything
could be done.
Just to show one real-world application, I attached a screen-shot of the
application I mentioned that's using this. All the controls in the
center scrolled window are being drawn using a PseudoDC except the
scrollbars. So with a large number of objects with close to full
coverage of a window, the PseudoDC is still able to give very smooth
scrolling.
-Paul
···
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Tuesday, June 20, 2006 6:22 PM
To: wxPython-dev@lists.wxwidgets.org
Subject: Re: [wxPython-dev] PseudoDC 1.0
Lanier, Paul wrote:
Hey Robin,
I've finally got what I think is a good initial version of the
PseudoDC.
Attached is the .cpp/.h/.i and PseudoDC.py which is a demo that fits
in the existing wxPython demo framework. In addition to the demo,
I've fiddled around with it some just to make sure that every method
actually works. Also, I've already using this in an application of
mine that is being used by several people where I work.I do already have a few things I plan to add in the future:
- Object level hit testing to easily match (x,y) with an object id.
- Methods to manipulate the Z order of objectsAlso, I didn't mirror every method from wx.DC because not all the
methods are useful in a recorded list. The attached file diff.out is
a list of all the methods not mirrored. If you think I should add
something then let me know. In addition to not mirroring some
methods, a few methods had return values that aren't supported in
PseudoDC since I won't know the return value until the list is played
back.
Let me know if you need something else. I did all my testing with
2.6.3.2 so the .i file I have is in that style.
Looks good. However I noticed that when the density of visible objects
increases then so does the CPU overhead when drawing the items. For
example, setting the demo parameters like this:
W = 1000
H = 1000
SHAPE_COUNT = 1000
will max out the CPU on my Linux box. So much so in fact that all of
the time is spend servicing the timer and other events are not being
sent. but if I increase the width and height to 10000 (thus greatly
lowering the object density) then it does fine. So I wonder if you can
think of any additional strategies for optimizations that would fit in
with what you have so far?
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org
