From 9e61f1b1e4e9a4d3f930828bc6c029f3f0e3ee08 Mon Sep 17 00:00:00 2001 From: ask Date: Thu, 31 Jan 2013 05:10:57 +0000 Subject: [PATCH] TAChart: Minor refactoring of "bgra" demo git-svn-id: trunk@40082 - --- components/tachart/demo/bgra/Main.lfm | 11 ++--------- components/tachart/demo/bgra/Main.pas | 24 +++++++++--------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/components/tachart/demo/bgra/Main.lfm b/components/tachart/demo/bgra/Main.lfm index c10c441226..bd9c8a7fa4 100644 --- a/components/tachart/demo/bgra/Main.lfm +++ b/components/tachart/demo/bgra/Main.lfm @@ -172,17 +172,10 @@ object Form1: TForm1 OnClick = btnStartStopClick TabOrder = 1 end - object lblSkipped: TLabel - Left = 9 - Height = 1 - Top = 340 - Width = 1 - ParentColor = False - end object Image1: TImage - Left = 9 + Left = 10 Height = 148 - Top = 176 + Top = 146 Width = 61 Picture.Data = { 1754506F727461626C654E6574776F726B477261706869636D0C000089504E47 diff --git a/components/tachart/demo/bgra/Main.pas b/components/tachart/demo/bgra/Main.pas index e620097b61..c4c4854ffc 100644 --- a/components/tachart/demo/bgra/Main.pas +++ b/components/tachart/demo/bgra/Main.pas @@ -26,7 +26,6 @@ type chSliceScaling: TChart; chSliceScalingBarSeries1: TBarSeries; Image1: TImage; - lblSkipped: TLabel; ListChartSource1: TListChartSource; PageControl1: TPageControl; PaintBox1: TPaintBox; @@ -50,12 +49,10 @@ type procedure rgMethodClick(Sender: TObject); private FAnimatedSource: TCustomAnimatedChartSource; + FSliceScaling: TBGRASliceScaling; procedure OnGetItem( ASource: TCustomAnimatedChartSource; AIndex: Integer; var AItem: TChartDataItem); - procedure OnStop(ASource: TCustomAnimatedChartSource); - public - sliceScaling: TBGRASliceScaling; end; var @@ -105,11 +102,14 @@ var temp: TBGRABitmap; sz: TPoint; begin + Unused(ASender); + Unused(APointIndex, AStackIndex); + ADoDefaultDrawing := false; sz := ARect.BottomRight - ARect.TopLeft; temp := TBGRABitmap.Create( - sliceScaling.BitmapWidth, Round(sliceScaling.BitmapWidth * sz.Y / sz.X)); + FSliceScaling.BitmapWidth, Round(FSliceScaling.BitmapWidth * sz.Y / sz.X)); try - sliceScaling.Draw(temp, 0, 0, temp.Width, temp.Height); + FSliceScaling.Draw(temp, 0, 0, temp.Width, temp.Height); temp.Draw(ACanvas, ARect); finally temp.Free; @@ -123,16 +123,15 @@ begin FAnimatedSource.AnimationInterval := 30; FAnimatedSource.AnimationTime := 1000; FAnimatedSource.OnGetItem := @OnGetItem; - FAnimatedSource.OnStop := @OnStop; chSliceScalingBarSeries1.Source := FAnimatedSource; - sliceScaling := TBGRASliceScaling.Create(Image1.Picture.Bitmap, 70, 0, 35, 0); - sliceScaling.AutodetectRepeat; + FSliceScaling := TBGRASliceScaling.Create(Image1.Picture.Bitmap, 70, 0, 35, 0); + FSliceScaling.AutodetectRepeat; end; procedure TForm1.FormDestroy(Sender: TObject); begin - sliceScaling.Free; + FSliceScaling.Free; end; procedure TForm1.PaintBox1Paint(Sender: TObject); @@ -175,11 +174,6 @@ begin end; end; -procedure TForm1.OnStop(ASource: TCustomAnimatedChartSource); -begin - lblSkipped.Caption := Format('Skipped frames: %d', [ASource.SkippedFramesCount]); -end; - procedure TForm1.rgMethodClick(Sender: TObject); begin FAnimatedSource.Start;