mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:29:29 +02:00
TAChart: fix wmf drawer crashing due to missing canvas in TADrawerWMF
git-svn-id: trunk@44559 -
This commit is contained in:
parent
7a5bfb6e30
commit
1e97dab2e1
@ -48,7 +48,7 @@ type
|
||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||
function GetBrushColor: TChartColor;
|
||||
function GetCanvas: TCanvas;
|
||||
function GetCanvas: TCanvas; virtual;
|
||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||
procedure Line(const AP1, AP2: TPoint);
|
||||
procedure LineTo(AX, AY: Integer); override;
|
||||
|
@ -86,13 +86,13 @@ type
|
||||
strict private
|
||||
FFileName: String;
|
||||
FMetafile: TMetafile;
|
||||
FMetafileCanvas: TMetafileCanvas;
|
||||
public
|
||||
constructor Create(const AFileName: String); reintroduce;
|
||||
destructor Destroy; override;
|
||||
public
|
||||
procedure DrawingBegin(const ABoundingBox: TRect); override;
|
||||
procedure DrawingEnd; override;
|
||||
function GetCanvas: TCanvas; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -119,7 +119,8 @@ end;
|
||||
procedure TWindowsMetafileDrawer.DrawingBegin(const ABoundingBox: TRect);
|
||||
begin
|
||||
inherited DrawingBegin(ABoundingBox);
|
||||
FCanvas := TMetafileCanvas.Create(FMetafile, 0);
|
||||
if FCanvas = nil then
|
||||
FCanvas := TMetafileCanvas.Create(FMetafile, 0);
|
||||
end;
|
||||
|
||||
procedure TWindowsMetafileDrawer.DrawingEnd;
|
||||
@ -128,6 +129,13 @@ begin
|
||||
FMetafile.SaveToFile(FFileName);
|
||||
end;
|
||||
|
||||
function TWindowsMetafileDrawer.GetCanvas: TCanvas;
|
||||
begin
|
||||
if FCanvas = nil then
|
||||
FCanvas := TMetafileCanvas.Create(FMetafile, 0);
|
||||
Result := FCanvas;
|
||||
end;
|
||||
|
||||
{ TMetafile }
|
||||
|
||||
procedure TMetafile.DeleteImage;
|
||||
|
Loading…
Reference in New Issue
Block a user