summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/fpg_base.pas2
-rw-r--r--src/corelib/gdi/fpg_gdi.pas22
2 files changed, 23 insertions, 1 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index aecd3b08..ae55637b 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -389,7 +389,7 @@ type
procedure DrawPolygon(Points: PPoint; NumPts: Integer; Winding: boolean = False); virtual;
procedure DrawPolygon(const Points: array of TPoint);
procedure StretchDraw (x, y, w, h: TfpgCoord; ASource: TfpgImageBase);
- procedure CopyRect(ADest_x, ADest_y: TfpgCoord; ASrcCanvas: TfpgCanvasBase; var ASrcRect: TfpgRect);
+ procedure CopyRect(ADest_x, ADest_y: TfpgCoord; ASrcCanvas: TfpgCanvasBase; var ASrcRect: TfpgRect); virtual;
// x,y is the top/left corner of where the text output will start.
procedure DrawString(x, y: TfpgCoord; const txt: string);
procedure FillRectangle(x, y, w, h: TfpgCoord); overload;
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index abeecbca..c8460a4c 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -147,6 +147,7 @@ type
public
constructor Create(awin: TfpgWindowBase); override;
destructor Destroy; override;
+ procedure CopyRect(ADest_x, ADest_y: TfpgCoord; ASrcCanvas: TfpgCanvasBase; var ASrcRect: TfpgRect); override;
end;
@@ -2131,6 +2132,27 @@ begin
inherited;
end;
+procedure TfpgGDICanvas.CopyRect(ADest_x, ADest_y: TfpgCoord; ASrcCanvas: TfpgCanvasBase;
+ var ASrcRect: TfpgRect);
+var
+ srcdc: HDC;
+ destdc: HDC;
+begin
+ if (TfpgWindow(FWindow).WinHandle <= 0) or (TfpgWindow(TfpgGDICanvas(ASrcCanvas).FWindow).WinHandle <= 0) then
+ begin
+ debugln(' no winhandle available');
+ exit;
+ end;
+
+ destdc := Windows.GetDC(TfpgWindow(FWindow).WinHandle);
+ srcdc := Windows.GetDC(TfpgWindow(TfpgGDICanvas(ASrcCanvas).FWindow).WinHandle);
+
+ BitBlt(destdc, ADest_x, ADest_y, ASrcRect.Width, ASrcRect.Height, srcdc, ASrcRect.Left, ASrcRect.Top, SRCCOPY);
+
+ ReleaseDC(TfpgWindow(TfpgGDICanvas(ASrcCanvas).FWindow).WinHandle, srcdc);
+ ReleaseDC(TfpgWindow(FWindow).WinHandle, destdc);
+end;
+
procedure TfpgGDICanvas.DoBeginDraw(awin: TfpgWindowBase; buffered: boolean);
var
ARect: TfpgRect;