Ignore:
Timestamp:
May 9, 2020, 9:35:25 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Better High DPI scaling on highdpi branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/IsoEngine.pas

    r210 r212  
    3434    function IsShoreTile(Loc: integer): boolean;
    3535    procedure MakeDark(Line: PPixelPointer; Length: Integer);
    36     procedure ShadeOutside(x0, y0, x1, y1, xm, ym: integer);
     36    procedure ShadeOutside(x0, y0, Width, Height, xm, ym: integer);
    3737  protected
    3838    FOutput: TDpiBitmap;
     
    10151015            1 + 8 * (xxt * 2 + 1), 1 + yyt + 16 * (yyt * 3 + 1));
    10161016          Borders.BeginUpdate;
    1017           for dy := 0 to yyt * 2 - 1 do
    1018           begin
    1019             PixelPtr := PixelPointer(Borders, 0, p1 * (yyt * 2) + dy);
    1020             for dx := 0 to xxt * 2 - 1 do begin
     1017          PixelPtr := PixelPointer(Borders, ScaleToVcl(0), ScaleToVcl(p1 * (yyt * 2)));
     1018          for dy := 0 to ScaleToVcl(yyt * 2) - 1 do begin
     1019            for dx := 0 to ScaleToVcl(xxt * 2) - 1 do begin
    10211020              if PixelPtr.Pixel^.B = 99 then begin
    10221021                PixelPtr.Pixel^.B := Tribe[p1].Color shr 16 and $FF;
     
    10261025              PixelPtr.NextPixel;
    10271026            end;
     1027            PixelPtr.NextLine;
    10281028          end;
    10291029          Borders.EndUpdate;
     
    13301330end;
    13311331
    1332 procedure TIsoMap.ShadeOutside(x0, y0, x1, y1, xm, ym: integer);
     1332procedure TIsoMap.ShadeOutside(x0, y0, Width, Height, xm, ym: integer);
    13331333const
    13341334  rShade = 3.75;
     
    13391339begin
    13401340  FOutput.BeginUpdate;
    1341   for y := y0 to y1 - 1 do begin
    1342     Line := PixelPointer(FOutput, 0, y);
    1343     y_n := (y - ym) / yyt;
    1344     if abs(y_n) < rShade then begin
     1341  Line := PixelPointer(FOutput, ScaleToVcl(x0), ScaleToVcl(y0));
     1342  for y := 0 to ScaleToVcl(Height) - 1 do begin
     1343    y_n := (ScaleFromVcl(y) + y0 - ym) / yyt;
     1344    if Abs(y_n) < rShade then begin
    13451345      // Darken left and right parts of elipsis
    1346       w_n := sqrt(sqr(rShade) - sqr(y_n));
    1347       wBright := trunc(w_n * xxt + 0.5);
    1348       Line.SetX(x0);
    1349       MakeDark(@Line, xm - x0 - wBright);
    1350       Line.SetX(xm + wBright);
    1351       MakeDark(@Line, x1 - xm - wBright);
     1346      w_n := Sqrt(Sqr(rShade) - Sqr(y_n));
     1347      wBright := Trunc(w_n * xxt + 0.5);
     1348      Line.SetX(0);
     1349      MakeDark(@Line, ScaleToVcl(xm - wBright));
     1350      Line.SetX(ScaleToVcl(xm + wBright));
     1351      MakeDark(@Line, ScaleToVcl(Width - xm - wBright));
    13521352    end else begin
    13531353      // Darken entire line
    1354       Line.SetX(x0);
    1355       MakeDark(@Line, x1 - x0);
     1354      Line.SetX(0);
     1355      MakeDark(@Line, ScaleToVcl(Width));
    13561356    end;
     1357    Line.NextLine;
    13571358  end;
    13581359  FOutput.EndUpdate;
     
    15761577    xm := x + (dx + 1) * xxt;
    15771578    ym := y + (dy + 1) * yyt + yyt;
    1578     ShadeOutside(FLeft, FTop, FRight, FBottom, xm, ym);
     1579    ShadeOutside(FLeft, FTop, FRight - FLeft, FBottom - FTop, xm, ym);
    15791580    CityGrid(xm, ym, CityAllowClick);
    15801581    for dy := -2 to ny + 1 do
Note: See TracChangeset for help on using the changeset viewer.