瀏覽代碼

* 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 -
sergei 14 年之前
父節點
當前提交
12f6eb2c4e
共有 1 個文件被更改,包括 17 次插入14 次删除
  1. 17 14
      rtl/objpas/types.pp

+ 17 - 14
rtl/objpas/types.pp

@@ -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;