Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 25, 2019 8:35 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Canvas rendering too slow?
PostPosted: Sun Nov 27, 2011 6:51 pm 
Offline

Joined: Sat Jul 16, 2011 2:45 pm
Posts: 76
Edit: also apologies for Posting in the wrong Section :s was supposed to be general>general :s

Hi all,

I have a Window with a container control within it - it's set up so that the container control always matches the size of the window. Within the container control is an array of canvases (82 currently) that are of all equal sizes and equally spaced out filling up the window...

The problem is, is that it's taking a good 2-3 seconds after the window was resized for the canvases to display

Upon being resized my method is fired which simply re-calculates the position of all the canvases, so it does some basic number calculations then there is a loop 1-82 setting the x,y positions of each canvas... is there any reason why it would have such a large delay?

It briefly looks like you can see them all shifting places pretty much instantly then they all dissapear and then all reappear at the same time after about 2+ seconds ?


Last edited by lukus001 on Mon Nov 28, 2011 9:43 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas rendering too slow?
PostPosted: Sun Nov 27, 2011 7:14 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Check how many times the paint event of each canvas is firing. If the canvases are too close together, any changes will ripple back and forth until they all settle down. If you have them positioned less than 4 pixels or so from one another, then you may need to refactor the design to use a single canvas with multiple display areas.


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas rendering too slow?
PostPosted: Sun Nov 27, 2011 8:44 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
why not use ONE canvas... and one Picture object

divide the picture object into 82 rectangles (or what ever to represent your current 82 canvas).

Update the picture object only when a change is required....

in the Canvas PAINT event simply put

g.drawpicture picobject,0,0


Done right, you can get well over 30 frames per second animation that way

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas rendering too slow?
PostPosted: Sun Nov 27, 2011 11:50 pm 
Offline

Joined: Sat Jul 16, 2011 2:45 pm
Posts: 76
Edit:

I worked out what was causing the issue.

My code that I was calling to position all the canvases had a loop just before it which created all the canvases i needed to use (based on how many images I had) from the single Canvas(0) array that I had in the container control. I was supposed to migrate it out as it's own method to be called before the positioning on the initial initialization and somehow left it in >.<

Now the canvases instantly reposition like a boss :3

So everytime i was repositioning the canvases I was creating another 82 canvases >.<
Doh!

Thanks for your replies! :)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group