would the wxPython Freeze / Thaw paradigm be appropriate here? that way, if you're only modifying one object, it will be redrawn as soon as you modify it. if you're modifying a bunch of objects, you wrap it between some Freeze / Thaw calls, and the drawing only happens at the Thaw.

Christopher Barker wrote:
Tim Ansell wrote:
It appears that if you do some operations like change the colour of an
object the (with SetColor) the object is not made dirty. This means that
the Canvas need to have a redrawn forced using Canvas.draw(True).

yup.

I'm trying to remember my logic here. One of the issues is that I've tried hard (not quite successfully) to keep the DrawObjects and the Canvas de-coupled. The idea was that I'd like to support having the same object on more than one Canvas. You can't quite do that now, but as I've had it in mind, I've tried to avoid any more coupling.

If the object itself is marked as Dirty, then the canvas would have to loop through all the objects to see if anything needed to be re-drawn -- this could have performance consequences. If the object marked the background or foreground dirty, then there would be coupling I don't want (though may be no so bad if there is a list of Canvases a given object is on -- it could just loop through them)

 > What do you think is the correct way to fix this problem?

I'm open to proposals!

 > Should FloatCanvas grow a proper system for redrawing dirtied objects?

It would be nice -- there is a lot to be said for being able to just alter an object, and have all the drawing take care of itself.

On the other hand, the app usually know when stuff has been changed, and can call Draw(True) easily enough. In fact, it is key that re-drawing itself does not happen whenever anything changes, as is is common to change a lot of stuff at once, and you wouldn't want to get the flicker and delay that would result from re-drawing on every action.

So far, it looks like the only actions that do mark the canvas as Dirty are shifting to/from the foreground/background.

If we do add this, it might be a good time to define a "dirty region", rather than the whole thing, so that less re-drawing can happen.

-Chris



_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to