mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 04:29:11 +02:00
Carbon intf: fixed invalid CGRect conversion with help from Tobias Giesen
git-svn-id: trunk@11968 -
This commit is contained in:
parent
5a58ffb486
commit
5efbc8540f
@ -1,4 +1,4 @@
|
||||
The following people contributed to Lazarus:
|
||||
The following people contributed to Lazarus:
|
||||
|
||||
A. J. Venter
|
||||
Aleksey Lagunov
|
||||
@ -93,6 +93,7 @@ Sergio Marcelo
|
||||
Shane Miller
|
||||
Stefan Hille
|
||||
Taras Boychuk
|
||||
Tobias Giesen
|
||||
Tomas Gregorovic
|
||||
Tom Lisjac
|
||||
Tony Maro
|
||||
|
@ -711,12 +711,22 @@ end;
|
||||
Returns: TRect
|
||||
------------------------------------------------------------------------------}
|
||||
function CGRectToRect(const ARect: CGRect): TRect;
|
||||
begin
|
||||
if CGRectIsNull(ARect) <> 0 then
|
||||
begin // CGRect passed is invalid!
|
||||
Result.Left := 0;
|
||||
Result.Top := 0;
|
||||
Result.Right := 0;
|
||||
Result.Bottom := 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
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;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Name: ParamsToHIRect
|
||||
@ -750,12 +760,22 @@ end;
|
||||
Returns: Carbon Rect
|
||||
------------------------------------------------------------------------------}
|
||||
function HIRectToCarbonRect(const ARect: HIRect): FPCMacOSAll.Rect;
|
||||
begin
|
||||
if CGRectIsNull(ARect) <> 0 then
|
||||
begin // CGRect passed is invalid!
|
||||
Result.Left := 0;
|
||||
Result.Top := 0;
|
||||
Result.Right := 0;
|
||||
Result.Bottom := 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
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;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Name: PointToHIPoint
|
||||
|
Loading…
Reference in New Issue
Block a user