Changeset 444 for GraphicTest


Ignore:
Timestamp:
Nov 22, 2012, 12:58:18 PM (12 years ago)
Author:
chronos
Message:
  • Added: Now draw frame size can be changed.
Location:
GraphicTest
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/UDrawForm.lfm

    r443 r444  
    44  Top = 208
    55  Width = 327
     6  BorderStyle = bsDialog
    67  Caption = 'Draw frame'
    78  FormStyle = fsStayOnTop
  • GraphicTest/UMainForm.lfm

    r443 r444  
    2424      end   
    2525      item
    26         Caption = 'Duration [ms]'
     26        Caption = 'Step draw duration [ms]'
    2727        Width = 80
    2828      end   
     
    3232      end   
    3333      item
    34         Caption = 'Step duration [ms]'
     34        Caption = 'Total step duration [ms]'
    3535        Width = 80
    3636      end   
     
    107107    ParentColor = False
    108108  end
     109  object SpinEditWidth: TSpinEdit
     110    Left = 363
     111    Height = 21
     112    Top = 411
     113    Width = 58
     114    Anchors = [akLeft, akBottom]
     115    MaxValue = 1000
     116    OnChange = SpinEditWidthChange
     117    TabOrder = 5
     118    Value = 320
     119  end
     120  object SpinEditHeight: TSpinEdit
     121    Left = 432
     122    Height = 21
     123    Top = 411
     124    Width = 58
     125    Anchors = [akLeft, akBottom]
     126    MaxValue = 1000
     127    OnChange = SpinEditHeightChange
     128    TabOrder = 6
     129    Value = 240
     130  end
     131  object Label3: TLabel
     132    Left = 328
     133    Height = 13
     134    Top = 416
     135    Width = 23
     136    Anchors = [akLeft, akBottom]
     137    Caption = 'Size:'
     138    ParentColor = False
     139  end
     140  object Label4: TLabel
     141    Left = 424
     142    Height = 13
     143    Top = 415
     144    Width = 6
     145    Anchors = [akLeft, akBottom]
     146    Caption = 'x'
     147    ParentColor = False
     148  end
    109149  object Timer1: TTimer
    110150    Interval = 500
  • GraphicTest/UMainForm.pas

    r443 r444  
    2525    Label1: TLabel;
    2626    Label2: TLabel;
     27    Label3: TLabel;
     28    Label4: TLabel;
    2729    ListViewMethods: TListView;
     30    SpinEditWidth: TSpinEdit;
     31    SpinEditHeight: TSpinEdit;
    2832    Timer1: TTimer;
    2933    procedure ButtonBenchmarkClick(Sender: TObject);
     
    3741    procedure ListViewMethodsSelectItem(Sender: TObject; Item: TListItem;
    3842      Selected: Boolean);
     43    procedure SpinEditHeightChange(Sender: TObject);
     44    procedure SpinEditWidthChange(Sender: TObject);
    3945    procedure Timer1Timer(Sender: TObject);
    4046  private
     
    4248    SingleTestActive: Boolean;
    4349    AllTestActive: Boolean;
     50    procedure GenerateSceneFrames;
    4451    procedure UpdateMethodList;
    4552    procedure UpdateInterface;
     53    procedure UpdateFrameSize;
    4654  public
    4755    FrameSize: TPoint;
     
    6674procedure TMainForm.FormCreate(Sender: TObject);
    6775var
    68   NewScene: TFastBitmap;
    6976  NewDrawMethod: TDrawMethod;
    7077  I: Integer;
    7178begin
     79  Scenes := TObjectList.Create;
     80
    7281  FrameSize := Point(320, 240);
    7382  Randomize;
    74   Scenes := TObjectList.Create;
    75   for I := 0 to SceneFrameCount - 1 do begin
    76     NewScene := TFastBitmap.Create;
    77     NewScene.Size := FrameSize;
    78     NewScene.RandomImage;
    79     Scenes.Add(NewScene);
    80   end;
    8183
    8284  DrawMethods := TObjectList.Create;
     
    169171procedure TMainForm.FormShow(Sender: TObject);
    170172begin
     173  UpdateFrameSize;
    171174  UpdateMethodList;
    172175  UpdateInterface;
     
    196199end;
    197200
     201procedure TMainForm.SpinEditHeightChange(Sender: TObject);
     202begin
     203  FrameSize.Y := SpinEditHeight.Value;
     204  UpdateFrameSize;
     205end;
     206
     207procedure TMainForm.SpinEditWidthChange(Sender: TObject);
     208begin
     209  FrameSize.X := SpinEditWidth.Value;
     210  UpdateFrameSize;
     211end;
     212
    198213procedure TMainForm.Timer1Timer(Sender: TObject);
    199214begin
    200215  UpdateMethodList;
     216end;
     217
     218procedure TMainForm.GenerateSceneFrames;
     219var
     220  I: Integer;
     221  NewScene: TFastBitmap;
     222begin
     223  Scenes.Clear;
     224  for I := 0 to SceneFrameCount - 1 do begin
     225    NewScene := TFastBitmap.Create;
     226    NewScene.Size := FrameSize;
     227    NewScene.RandomImage;
     228    Scenes.Add(NewScene);
     229  end;
    201230end;
    202231
     
    212241  ButtonBenchmark.Enabled := not AllTestActive and not SingleTestActive;
    213242  ButtonStop.Enabled := SingleTestActive or AllTestActive;
     243  SpinEditWidth.MaxValue := Screen.DesktopWidth;
     244  SpinEditHeight.MaxValue := Screen.DesktopHeight;
     245end;
     246
     247procedure TMainForm.UpdateFrameSize;
     248begin
     249  DrawForm.SetBounds(DrawForm.Left, DrawForm.Top, FrameSize.X, FrameSize.Y);
     250  GenerateSceneFrames;
    214251end;
    215252
Note: See TracChangeset for help on using the changeset viewer.