Prechádzať zdrojové kódy

Two static inline constructors

git-svn-id: trunk@43950 -
marco 5 rokov pred
rodič
commit
7fc9212ecd
1 zmenil súbory, kde vykonal 13 pridanie a 0 odobranie
  1. 13 0
      rtl/objpas/types.pp

+ 13 - 0
rtl/objpas/types.pp

@@ -130,6 +130,8 @@ type
           function  Floor   : TPoint;
           function  Round   : TPoint;
           function  Length  : Single;
+          class function Create(const ax, ay: Single): TPointF; overload; static; inline;
+          class function Create(const apt: TPoint): TPointF; overload; static; inline;
           class operator = (const apt1, apt2 : TPointF) : Boolean;
           class operator <> (const apt1, apt2 : TPointF): Boolean;
           class operator + (const apt1, apt2 : TPointF): TPointF;
@@ -662,6 +664,17 @@ begin
   x:=ax; y:=ay;
 end;
 
+class function TPointF.Create(const ax, ay: Single): TPointF;
+begin
+  Result.x := ax;
+  Result.y := ay;
+end;
+
+class function TPointF.Create(const apt: TPoint): TPointF;
+begin
+  Result.x := apt.X;
+  Result.y := apt.Y;
+end;
 { TRectF }
 
 function TRectF.GetHeight: Single;