On Dec 29, 2005, at 6:22 PM, Ben Farhner wrote:
Well I got it all sorted out by removing the progress bar and
replacing it with chasingarrows. I wish I could use the
RGBSurface.Transform(), but its not available in 5.2.4. Is it still
possible to get 5.5?
I didn't realize that Transform was not introduced until 5.5.
With that in mind, here is how I would optimize the loop:
Dim xMax As Integer
Dim yMax As Integer
xMax = p.Width - 1
yMax = p.Height - 1
For j = 0 To yMax
For i = 0 To xMax
c = r1.pixel(i,j)
r2.pixel(i,j) = RGB(255-c.red, 255-c.green, 255-c.blue)
Next
progress.prog.value=progress.prog.value+1
Next
Set the Progress.Maximum to equal the number of rows (height) instead
of the number of pixels like you had before. Notice that I switched
the rows and columns... it is only a theory, but it should be faster
to access memory sequentially instead of jumping around in memory
like you were by processing the columns with the outer loop.
I would be interested to know how much of an improvement this would
provide.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|