I took your example of simple mirror and changed it.
The speed is now on a MacBookPro mid 2010 using LC 8 RC1
for
640 x 480 about 150 milliseconds
for
1600 x 1200 about 850 milliseconds
times include final screen update. And I use the old paintCompression trick I learned from you. Here "RLE" saves quite some milliseconds compared to "PNG". This is not as consistent as it used to be.
I am still trying to find patterns of what works best in the LC 8 series.
Code: Select all
local x="eins"
on mouseUp
put the paintCompression into tOldPCompression
set the paintCompression to "RLE"
put the milliseconds into strt
lock screen; lock messages
set cursor to watch
put the imageData of image x into iData
put the height of img x into theight
put the width of img x into twidth
put 4*twidth into re
put trunc(twidth/2)*4 into tWHalf
put 1 + tWHalf into tStart
put re into tUntil
put "" into tCollect
repeat with i = 1 to tHeight
put byte tStart to tUntil of iData into tRightHalfLine
repeat with j = tWHalf to 4 step - 4
put byte j - 3 to j of tRightHalfLine after tCollect
end repeat
put tRightHalfLine after tCollect
add re to tStart
add re to tUntil
end repeat
set imageData of image x to tCollect
unlock screen; unlock messages
put the milliseconds - strt into fld "test"
set the paintCompression to tOldPCompression
end mouseUp
Bevore anyone asks: I collect the data putting "after variable tCollect". This is easy and in my experience faster than writing into an existing variable. I tried for this special case(only half the data is changed) to write into the variable of the imageData (iData). It is a tad slower and makes the code more complicated.
Kind regards
Bernd