* types.pp, applied a fix similar to r16224,16226 also to UnionRect function. It is very similar to IntersectRect and parameter aliasing issue applies to it as well (see Mantis #17722).

git-svn-id: trunk@16235 -
This commit is contained in:
sergei 2010-10-28 04:18:53 +00:00
parent 4468f72f6c
commit 12f6eb2c4e

View File

@ -373,26 +373,29 @@ begin
end;
function UnionRect(var Rect : TRect;const R1,R2 : TRect) : Boolean;
var
lRect: TRect;
begin
Rect:=R1;
with R2 do
begin
if Left<R1.Left then
Rect.Left:=Left;
if Top<R1.Top then
Rect.Top:=Top;
if Right>R1.Right then
Rect.Right:=Right;
if Bottom>R1.Bottom then
Rect.Bottom:=Bottom;
end;
lRect:=R1;
if R2.Left<R1.Left then
lRect.Left:=R2.Left;
if R2.Top<R1.Top then
lRect.Top:=R2.Top;
if R2.Right>R1.Right then
lRect.Right:=R2.Right;
if R2.Bottom>R1.Bottom then
lRect.Bottom:=R2.Bottom;
if IsRectEmpty(Rect) then
begin
begin
FillChar(Rect,SizeOf(Rect),0);
UnionRect:=false;
end
end
else
begin
Rect:=lRect;
UnionRect:=true;
end;
end;
function IsRectEmpty(const Rect : TRect) : Boolean;