Changeset 454 for GraphicTest/UMainForm.pas
- Timestamp:
- Nov 26, 2012, 7:38:56 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/UMainForm.pas
r453 r454 9 9 Graphics, Dialogs, ComCtrls, ExtCtrls, StdCtrls, DateUtils, UPlatform, 10 10 LCLType, IntfGraphics, fpImage, Math, GraphType, Contnrs, LclIntf, Spin, 11 ActnList, Menus, StdActns, UFastBitmap, UDrawMethod ;11 ActnList, Menus, StdActns, UFastBitmap, UDrawMethod, typinfo; 12 12 13 13 const … … 19 19 20 20 TMainForm = class(TForm) 21 Action1: TAction; 21 AShowDrawForm: TAction; 22 ATestAllMethods: TAction; 23 ATestOneMethod: TAction; 24 ATestStop: TAction; 22 25 AExportAsWikiText: TAction; 23 26 ActionList1: TActionList; … … 28 31 CheckBoxDoubleBuffered: TCheckBox; 29 32 CheckBoxEraseBackground: TCheckBox; 33 ComboBox1: TComboBox; 30 34 FileExit1: TFileExit; 31 35 FloatSpinEdit1: TFloatSpinEdit; … … 34 38 Label3: TLabel; 35 39 Label4: TLabel; 40 Label5: TLabel; 36 41 ListViewMethods: TListView; 37 42 MainMenu1: TMainMenu; … … 40 45 MenuItem2: TMenuItem; 41 46 MenuItem3: TMenuItem; 47 MenuItem4: TMenuItem; 48 MenuItem8: TMenuItem; 49 MenuItemTest: TMenuItem; 50 MenuItem5: TMenuItem; 51 MenuItem6: TMenuItem; 52 MenuItem7: TMenuItem; 42 53 PageControl1: TPageControl; 43 54 Panel1: TPanel; … … 52 63 TimerUpdateList: TTimer; 53 64 procedure AExportAsWikiTextExecute(Sender: TObject); 54 procedure ButtonBenchmarkClick(Sender: TObject); 55 procedure ButtonSingleTestClick(Sender: TObject); 56 procedure ButtonStopClick(Sender: TObject); 65 procedure AShowDrawFormExecute(Sender: TObject); 66 procedure ATestAllMethodsExecute(Sender: TObject); 67 procedure ATestOneMethodExecute(Sender: TObject); 68 procedure ATestStopExecute(Sender: TObject); 57 69 procedure CheckBox1Change(Sender: TObject); 58 70 procedure CheckBoxDoubleBufferedChange(Sender: TObject); 59 71 procedure CheckBoxEraseBackgroundChange(Sender: TObject); 72 procedure ComboBox1Change(Sender: TObject); 60 73 procedure FormCreate(Sender: TObject); 61 74 procedure FormDestroy(Sender: TObject); … … 81 94 public 82 95 FrameSize: TPoint; 96 PixelFormat: TPixelFormat; 83 97 DrawMethods: TObjectList; // TObjectList<TDrawMethod> 84 98 Scenes: TObjectList; // TObjectList<TFastBitmap> … … 114 128 NewDrawMethod: TDrawMethod; 115 129 I: Integer; 130 PF: TPixelFormat; 116 131 begin 117 132 Scenes := TObjectList.Create; … … 126 141 end; 127 142 143 for PF := Low(TPixelFormat) to High(TPixelFormat) do 144 ComboBox1.Items.Add(GetEnumName(TypeInfo(TPixelFormat), Integer(PF))); 145 128 146 PageControl1.TabIndex := 0; 129 147 end; … … 135 153 begin 136 154 with Method do begin 137 Init(DrawForm, FrameSize); 138 TestTerminated := False; 155 Init(DrawForm, FrameSize, PixelFormat); 139 156 //Application.ProcessMessages; 140 157 StartTime := NowPrecise; … … 154 171 //FPS := GetFPS; 155 172 Done; 156 end;157 end;158 159 procedure TMainForm.ButtonSingleTestClick(Sender: TObject);160 begin161 if Assigned(ListViewMethods.Selected) then162 try163 SingleTestActive := True;164 UpdateInterface;165 TimerUpdateList.Enabled := True;166 MethodIndex := ListViewMethods.Selected.Index;167 TestTimeout := -1;168 if MethodIndex >= 0 then169 TestMethod(TDrawMethod(DrawMethods[MethodIndex]));170 finally171 //TimerUpdateList.Enabled := False;172 SingleTestActive := False;173 UpdateInterface;174 end;175 end;176 177 procedure TMainForm.ButtonBenchmarkClick(Sender: TObject);178 var179 I: Integer;180 begin181 try182 AllTestActive := True;183 UpdateInterface;184 TimerUpdateList.Enabled := True;185 TestTerminated := False;186 TestTimeout := FloatSpinEdit1.Value;187 with ListViewMethods, Items do188 for I := 0 to DrawMethods.Count - 1 do189 with TDrawMethod(DrawMethods[I]) do begin190 TestMethod(TDrawMethod(DrawMethods[I]));191 end;192 finally193 TimerUpdateList.Enabled := False;194 AllTestActive := False;195 UpdateInterface;196 173 end; 197 174 end; … … 225 202 end; 226 203 227 procedure TMainForm.ButtonStopClick(Sender: TObject); 204 procedure TMainForm.AShowDrawFormExecute(Sender: TObject); 205 begin 206 DrawForm.Show; 207 end; 208 209 procedure TMainForm.ATestAllMethodsExecute(Sender: TObject); 210 var 211 I: Integer; 212 begin 213 try 214 AllTestActive := True; 215 UpdateInterface; 216 TimerUpdateList.Enabled := True; 217 TestTerminated := False; 218 TestTimeout := FloatSpinEdit1.Value; 219 with ListViewMethods, Items do 220 for I := 0 to DrawMethods.Count - 1 do 221 with TDrawMethod(DrawMethods[I]) do begin 222 TestMethod(TDrawMethod(DrawMethods[I])); 223 if TestTerminated then Break; 224 end; 225 finally 226 TimerUpdateList.Enabled := False; 227 AllTestActive := False; 228 UpdateInterface; 229 end; 230 end; 231 232 procedure TMainForm.ATestOneMethodExecute(Sender: TObject); 233 begin 234 if Assigned(ListViewMethods.Selected) then 235 try 236 SingleTestActive := True; 237 UpdateInterface; 238 TimerUpdateList.Enabled := True; 239 TestTerminated := False; 240 MethodIndex := ListViewMethods.Selected.Index; 241 TestTimeout := -1; 242 if MethodIndex >= 0 then 243 TestMethod(TDrawMethod(DrawMethods[MethodIndex])); 244 finally 245 //TimerUpdateList.Enabled := False; 246 SingleTestActive := False; 247 UpdateInterface; 248 end; 249 end; 250 251 procedure TMainForm.ATestStopExecute(Sender: TObject); 228 252 begin 229 253 TestTerminated := True; … … 249 273 end; 250 274 275 procedure TMainForm.ComboBox1Change(Sender: TObject); 276 begin 277 PixelFormat := TPixelFormat(ComboBox1.ItemIndex); 278 UpdateInterface; 279 end; 280 251 281 procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction); 252 282 begin 253 ButtonStopClick(Self);283 ATestStop.Execute; 254 284 end; 255 285 … … 354 384 CheckBoxEraseBackground.Checked := DrawForm.EraseBackgroundEnabled; 355 385 CheckBox1.Checked := csOpaque in DrawForm.ControlStyle; 386 ComboBox1.ItemIndex := Integer(PixelFormat); 356 387 end; 357 388
Note:
See TracChangeset
for help on using the changeset viewer.