From: "Daniel P. Zepeda" Date: 2003-01-15T08:07:57+09:00 Subject: Re: FXRuby problem on Windows On Wed, 15 Jan 2003 05:15:39 +0900 Lyle Johnson wrote: >So I guess during initialization you'd want to construct the device >contexts (for the canvas and the image) and then immediately unlock them: > > @sdc = FXDCWindow( @canvas ) > @sdc.end > @idc = FXDCWindow( @image ) > @idc.end >and then when you "really" need to use them, call begin and pass in the >associated drawable object: > > def onPaint( sender, sel, event ) > @sdc.begin( @canvas ) > @sdc.drawImage( @image, 0, 0 ) > @sdc.end > end > > Be sure to make a similar change in the image drawing routine(s). > > Give this a shot, and if the performance still seems unacceptable, maybe > we can investigate some other optimizations (e.g. double-buffered > drawing of the image). Well, I'm glad that the app ran badly on windows, if you can believe that. It forced me to re-evaluate my use of Device Contexts. My initial attempts were clumsy at best. I have a better understanding now of Device Contexts and their use. Thank you Lyle. The approach you suggested works well, except that I ended up only using one DC and just associating it with each drawable as needed. Since the code runs sequentially, drawing one thing after another, it seemed a waste to use more than one DC. My application runs just fine now under both Linux and Windows, and I've cut down on unneeded resource usage even more. > > Hope this helps, Yes indeedy and thanks again for your time. > > Lyle > -- "Daniel P. Zepeda" (Remove commas for address)