Hello,
I had problems with arithmetic exceptions in the following routine.
I was not able to find the root of the problem, so I added this
quick safety check. This makes my application work stable. Should I
submit this as a patch?
The problem is that ARect.origin.x sometimes is +Inf or other invalid
numbers.
function CGRectToRect(const ARect: CGRect): TRect;
begin
if (ARect.origin.x<-1e10) or
(ARect.origin.x>1e10) then begin
WriteLn(StdErr,'CGRectToRect: ARect.origin.x is suspicious, returning a
zero TRect.');
Result.Left := 0;
Result.Top := 0;
Result.Right := 0;
Result.Bottom := 0;
Exit;
end;
Result.Left := Floor(ARect.origin.x);
Result.Top := Floor(ARect.origin.y);
Result.Right := Ceil(ARect.origin.x + ARect.size.width);
Result.Bottom := Ceil(ARect.origin.y + ARect.size.height);
end;
Cheers,
Tobias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives