Please, need help for optimisation
BlitzMax Forums/BlitzMax Programming/Please, need help for optimisation
| ||
Hello :-) Since i've not found any deluxepaint like program under linux, i'm trying to program one. But i'm new to linux and i'm new to Bmax. Can someone help me to optimise the code ? Because it's too slow to under a Pentium D925 with 2,5Go Ram. This is the code i've done for now : End |
| ||
You should post it in the forum in a codebox or something: http://blitzbasic.com/faq/faq_entry.php?id=2 |
| ||
Thanks Azathoth, this is a long time i search to do that. So, does someone see the problem i have ? It is very slow. |
| ||
The Gimp does pixel-based painting, doesn't it ? You might even find it already installed on your Linux distro. (it appears under Graphics, in my taskbar menu). In your Dot function I'm sure you can change this: If X1<0 Then X1=0 If X1>=PixmapWidth(buf) Then X1=PixmapWidth(buf)-1 into this X1 = Min(Max(X1, 0), PixmapWidth(buf) - 1) As Azathoth says though, stick the code into a {codebox}{/codebox} (replace the curly brackets with square ones). :o) |
| ||
Thanks Brucey :-) (I'm running Bmax under Mandriva Spring 2007) |
| ||
The main problems appear to be the events. Your drawing code is wrapped up inside the paint function. You might find it will work better if you call the drawing functions as part of your mouse move/down/up code, rather than forcing a redraw of the gadget. The time before the gadget is actually redrawn is undetermined, especially since you appear to be updating it 60 times a second anyways. You could always only refresh the canvas when it needs to be refreshed (ie. after you've changed the underlying pixmap in some way). Also, drawing the pixmap every frame (instead of its Image), is slow. |
| ||
Thanks Brucey I will see what i can do |
| ||
I've changed a lot of things and it works better now. Is there a command to free the events queue ? (i would like to free it when the menu is opened ? |