Ignore:
Timestamp:
May 21, 2020, 8:17:38 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Update from trunk rev 245.
  • Modified: Vcl prefix/suffix changed to Native.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Start.pas

    r244 r246  
    4848    Bitmap: TDpiBitmap; { game world sample preview }
    4949    Size: TPoint;
    50     Colors: array [0..fTerrain, 0..1] of TColor;
     50    Colors: array [0 .. 11, 0 .. 1] of TColor;
    5151    Mode: TMiniMode;
    5252    procedure LoadFromLogFile(FileName: string; var LastTurn: Integer);
     
    355355  Bitmap.BeginUpdate;
    356356  MiniPixel := PixelPointer(Bitmap);
    357   for y := 0 to ScaleToVcl(Size.Y) - 1 do begin
    358     for x := 0 to ScaleToVcl(Size.X) - 1 do begin
     357  for y := 0 to ScaleToNative(Size.Y) - 1 do begin
     358    for x := 0 to ScaleToNative(Size.X) - 1 do begin
    359359      for i := 0 to 1 do begin
    360         xm := (x * 2 + i + y and 1) mod (ScaleToVcl(Size.X) * 2);
     360        xm := (x * 2 + i + y and 1) mod (ScaleToNative(Size.X) * 2);
    361361        MiniPixel.SetX(xm);
    362362        cm := Colors
    363           [Map[ScaleFromVcl(x) * lxmax div Size.X + lxmax *
    364           ((ScaleFromVcl(y) * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and
     363          [Map[ScaleFromNative(x) * lxmax div Size.X + lxmax *
     364          ((ScaleFromNative(y) * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and
    365365          fTerrain, i];
    366366        MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3;
     
    388388    MiniPixel := PixelPointer(Bitmap);
    389389    PrevMiniPixel := PixelPointer(Bitmap, 0, -1);
    390     for y := 0 to ScaleToVcl(Size.Y) - 1 do begin
    391       for x := 0 to ScaleToVcl(Size.X) - 1 do begin
     390    for y := 0 to ScaleToNative(Size.Y) - 1 do begin
     391      for x := 0 to ScaleToNative(Size.X) - 1 do begin
    392392        for i := 0 to 1 do begin
    393           xm := (x * 2 + i + y and 1) mod (ScaleToVcl(Size.X) * 2);
     393          xm := (x * 2 + i + y and 1) mod (ScaleToNative(Size.X) * 2);
    394394          MiniPixel.SetX(xm);
    395           Tile := SaveMap[ScaleFromVcl(x) + Size.X * ScaleFromVcl(y)];
     395          Tile := SaveMap[ScaleFromNative(x) + Size.X * ScaleFromNative(y)];
    396396          if Tile and fTerrain = fUNKNOWN then
    397397            cm := $000000
     
    694694    Location := Point((DpiScreen.Width - 800) * 3 div 8,
    695695      DpiScreen.Height - Height - (DpiScreen.Height - 600) div 3);
    696     Left := Location.X;
    697     Top := Location.Y;
     696    BoundsRect := Bounds(Location.X, Location.Y, Width, Height);
    698697
    699698    r0 := DpiCreateRectRgn(0, 0, Width, Height);
     
    708707    DeleteObject(r0); // causes crash with Windows 95
    709708  end else begin
    710     Left := (DpiScreen.Width - Width) div 2;
    711     Top := (DpiScreen.Height - Height) div 2;
     709    BoundsRect := Bounds((DpiScreen.Width - Width) div 2,
     710      (DpiScreen.Height - Height) div 2, Width, Height)
    712711  end;
    713712end;
     
    16091608  if Tab <> tbNew then
    16101609    if List.Count > 0 then begin
    1611       if (List.Count > ListIndex[Tab]) then
     1610      if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then
    16121611        List.ItemIndex := ListIndex[Tab]
    16131612        else List.ItemIndex := 0;
Note: See TracChangeset for help on using the changeset viewer.