diff --git a/Units/MMLCore/bitmaps.pas b/Units/MMLCore/bitmaps.pas index 198e938..f205304 100644 --- a/Units/MMLCore/bitmaps.pas +++ b/Units/MMLCore/bitmaps.pas @@ -4,7 +4,7 @@ unit bitmaps; interface uses - Classes, SysUtils, FPImgCanv,FPImage,IntfGraphics,graphtype,MufasaTypes ,graphics; + Classes, SysUtils, FPImgCanv,FPImage,IntfGraphics,graphtype,MufasaTypes,window,graphics; type @@ -33,6 +33,7 @@ type procedure FastDrawClear(Color : TColor); procedure FastDrawTransparent(x, y: Integer; TargetBitmap: TMufasaBitmap); procedure FastReplaceColor(OldColor, NewColor: TColor); + procedure CopyClientToBitmap(MWindow : TMWindow; xs, ys, xe, ye: Integer); constructor Create; destructor Destroy;override; end; @@ -404,6 +405,22 @@ begin FData[i] := NewCol; end; +procedure TMufasaBitmap.CopyClientToBitmap(MWindow : TMWindow; xs, ys, xe, ye: Integer); +var + wi,hi,y : integer; + PtrRet : TRetData; + Rows : integer; +begin + Self.ValidatePoint(xs,ys); + Self.ValidatePoint(xe,ye); + wi := xe-xs + 1; + hi := ye-ys + 1; + PtrRet := MWindow.ReturnData(xs,ys,wi,hi); + for y := 0 to (hi-1) do + Move(PtrRet.Ptr[y * (wi + PtrRet.IncPtrWith)], FData[y * self.w],wi * SizeOf(TRGB32)); + MWindow.FreeReturnData; +end; + constructor TMBitmaps.Create(Owner: TObject); begin inherited Create; diff --git a/Units/MMLCore/window.pas b/Units/MMLCore/window.pas index 58ee02d..c03e0ab 100644 --- a/Units/MMLCore/window.pas +++ b/Units/MMLCore/window.pas @@ -303,6 +303,7 @@ begin PtrReturn := Self.ReturnData(0,0,w,h); GetMem(Self.FrozenData, w * h * sizeof(TRGB32)); Move(PtrReturn.Ptr[0], FrozenData[0], w*h*sizeof(TRGB32)); + Self.FreeReturnData; Self.FreezeState:=True; end;