Errors in TFPCustomCanvas.CopyRect
Original Reporter info from Mantis: zipfelvo
-
Reporter name:
Original Reporter info from Mantis: zipfelvo
- Reporter name:
Description:
Tried to use TFPCustomCanvas.CopyRect - it doesn't work. The source code is simple but quite weird:
var xx,r,t : integer;
begin
SortRect (SourceRect);
with SourceRect do
for r := left to right do
begin
xx := r - left + x;
for t := bottom to top do
colors[xx,(t - bottom + y)] := canvas.colors[r,t];
end;
end;
- The line "for t := bottom to top do" is wrong - "bottom" is larger then "top" -> "for t := bottom downto top do".
- In the next line: "t - bottom + y" "t" is equal or smaller then "bottom", so "t - bottom + y" will become negative ("y" is often zero).
- The inner loop is in y-direction. This will cause many cpu cache misses.
Added a patch to solve this problems.
Mantis conversion info:
- Mantis ID: 18460
- OS: linux
- Platform: amd64
- Version: 2.4.2
- Fixed in version: 2.4.4
- Fixed in revision: 16778 (#7624d5f1)
- Target version: 3.0.0