- Timestamp:
- Jun 26, 2020, 1:13:34 AM (4 years ago)
- Location:
- branches/highdpi
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/GameServer.pas
r246 r266 289 289 FreeLibrary(hm); 290 290 end; 291 PlayersBrain.Free;292 bix.Free;293 Brains.Free;291 FreeAndNil(PlayersBrain); 292 FreeAndNil(bix); 293 FreeAndNil(Brains); 294 294 end; 295 295 -
branches/highdpi/Packages/CevoComponents/BaseWin.pas
r210 r266 106 106 destructor TBufferedDrawDlg.Destroy; 107 107 begin 108 Offscreen.Free; 108 // Name 109 FreeAndNil(Offscreen); 109 110 inherited Destroy; 110 111 end; … … 496 497 begin 497 498 if Offscreen <> nil then 498 exit;499 Exit; 499 500 Offscreen := TDpiBitmap.Create; 500 501 Offscreen.PixelFormat := pf24bit; -
branches/highdpi/Packages/CevoComponents/ScreenTools.pas
r265 r266 406 406 jtex := TDpiJpegImage.Create; 407 407 try 408 jtex.LoadFromFile(Path); 409 except 410 Result := False; 411 end; 412 if Result then 413 begin 414 if Options and gfNoGamma = 0 then 415 bmp.PixelFormat := pf24bit; 416 Bmp.SetSize(jtex.Width, jtex.Height); 417 Bmp.Canvas.Draw(0, 0, jtex); 418 end; 419 jtex.Free; 408 try 409 jtex.LoadFromFile(Path); 410 except 411 Result := False; 412 end; 413 if Result then 414 begin 415 if Options and gfNoGamma = 0 then 416 bmp.PixelFormat := pf24bit; 417 Bmp.SetSize(jtex.Width, jtex.Height); 418 Bmp.Canvas.Draw(0, 0, jtex); 419 end; 420 finally 421 FreeAndNil(jtex); 422 end; 420 423 end 421 424 else 422 425 if ExtractFileExt(Path) = '.png' then begin 423 426 Png := TDpiPortableNetworkGraphic.Create; 424 Png.PixelFormat := Bmp.PixelFormat;425 427 try 426 Png.LoadFromFile(Path); 427 except 428 Result := False; 429 end; 430 if Result then 431 begin 432 if Options and gfNoGamma = 0 then 433 bmp.PixelFormat := pf24bit; 434 bmp.SetSize(Png.Width, Png.Height); 435 if (Png.RawImage.Description.Format = ricfGray) then 436 begin 437 // LCL doesn't support 8-bit colors properly. Use 24-bit instead. 438 Bmp.PixelFormat := pf24bit; 439 CopyGray8BitTo24bitBitmap(Bmp, Png); 440 end 441 else 442 Bmp.Canvas.draw(0, 0, Png); 443 end; 444 Png.Free; 445 end 446 else 428 Png.PixelFormat := Bmp.PixelFormat; 429 try 430 Png.LoadFromFile(Path); 431 except 432 Result := False; 433 end; 434 if Result then begin 435 if Options and gfNoGamma = 0 then 436 bmp.PixelFormat := pf24bit; 437 bmp.SetSize(Png.Width, Png.Height); 438 if (Png.RawImage.Description.Format = ricfGray) then 439 begin 440 // LCL doesn't support 8-bit colors properly. Use 24-bit instead. 441 Bmp.PixelFormat := pf24bit; 442 CopyGray8BitTo24bitBitmap(Bmp, Png); 443 end else 444 Bmp.Canvas.draw(0, 0, Png); 445 end; 446 finally 447 FreeAndNil(Png); 448 end; 449 end else 447 450 if ExtractFileExt(Path) = '.bmp' then begin 448 451 try … … 455 458 bmp.PixelFormat := pf24bit; 456 459 end; 457 end 458 else 460 end else 459 461 raise Exception.Create('Unsupported image file type ' + ExtractFileExt(Path)); 460 462 … … 1728 1730 RestoreResolution; 1729 1731 for I := 0 to nGrExt - 1 do begin 1730 GrExt[I].Data.Free;1731 GrExt[I].Mask.Free;1732 FreeAndNil(GrExt[I].Data); 1733 FreeAndNil(GrExt[I].Mask); 1732 1734 FreeMem(GrExt[I]); 1733 1735 end; -
branches/highdpi/Packages/DpiControls/UDpiControls.pas
r265 r266 812 812 FMainForm: TDpiForm; 813 813 FCreatingForm: TDpiForm; 814 FOldExitProc: Pointer; 814 815 function GetActive: Boolean; 815 816 function GetShowMainForm: Boolean; … … 821 822 protected 822 823 function GetNativeApplication: TApplication; virtual; 824 procedure DoBeforeFinalization; 823 825 public 824 826 constructor Create(AOwner: TComponent); override; … … 1594 1596 end; 1595 1597 1598 procedure DpiBeforeFinalization; 1599 // This is our ExitProc handler. 1600 begin 1601 DpiApplication.DoBeforeFinalization; 1602 end; 1603 1604 procedure TDpiApplication.DoBeforeFinalization; 1605 var 1606 i: Integer; 1607 C: TComponent; 1608 begin 1609 if Self = nil then Exit; 1610 for i := ComponentCount - 1 downto 0 do begin 1611 if i < ComponentCount then begin 1612 C := Components[i]; 1613 // C.Name 1614 C.Free; 1615 end; 1616 end; 1617 end; 1618 1596 1619 function DpiFindApplicationComponent(const ComponentName: string): TComponent; 1597 1620 // Note: this function is used by TReader to auto rename forms to unique names. … … 1603 1626 begin 1604 1627 RegisterFindGlobalComponentProc(@DpiFindApplicationComponent); 1628 FOldExitProc := ExitProc; 1629 ExitProc := @DpiBeforeFinalization; 1605 1630 inherited; 1606 1631 end; … … 1608 1633 destructor TDpiApplication.Destroy; 1609 1634 begin 1635 ExitProc := FOldExitProc; 1610 1636 inherited Destroy; 1611 1637 end; … … 3736 3762 destructor TDpiForm.Destroy; 3737 3763 begin 3764 // Name 3738 3765 // TODO: Can't destroy directly? 3739 3766 //FreeAndNil(NativeForm); 3767 3768 TFormEx(NativeForm).OnMessage := nil; 3740 3769 DpiScreen.RemoveForm(Self); 3741 3770 end;
Note:
See TracChangeset
for help on using the changeset viewer.