I squeezed a little more out of putimage by doing as little math as possible with a couple of variables to store j*ptcwidth and i+j*ptcwidth I got my 1000x test loop down to 1.013 seconds. Here is what it looks like at the moment, any ideas on how to optimize it further?
https://github.com/Zaaphod/ptcpas/compare/master...Zaaphod_Custom#diff-fb31461e009ff29fda5c35c5115978b4 var pixels:Pword; k: longint; i, j, y1, x1, deltaX, deltaX1, deltaY: smallint; JxW, I_JxW: Longword; .. XORPut: Begin for j:=Y to Y1 do Begin JxW:=j*PTCWidth; inc(k,deltaX); for i:=X to X1 do begin I_JxW:=i+JxW; pixels[I_JxW] := pixels[I_JxW] xor pt(bitmap)[k]; inc(k); end; inc(k,deltaX1); End; End; .. James
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal