mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-27 03:29:22 +02:00
* empty Rect does not extend the rect in UnionRect, based on patch provided by Werner Pamler, resolves #40680
This commit is contained in:
parent
c96b0f6ca5
commit
f67165ae31
@ -875,19 +875,26 @@ function UnionRect(var Rect : TRect;const R1,R2 : TRect) : Boolean;
|
||||
var
|
||||
lRect: TRect;
|
||||
begin
|
||||
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(R1) then
|
||||
lRect:=R2
|
||||
else if IsRectEmpty(R2) then
|
||||
lRect:=R1
|
||||
else
|
||||
begin
|
||||
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;
|
||||
end;
|
||||
|
||||
Result:=not IsRectEmpty(lRect);
|
||||
if Result then
|
||||
Rect := lRect
|
||||
Rect:=lRect
|
||||
else
|
||||
FillChar(Rect,SizeOf(Rect),0);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user