Ignore:
Timestamp:
May 9, 2020, 4:02:07 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File:
1 edited

Legend:

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

    r179 r210  
    55
    66uses
    7   ScreenTools, BaseWin, Protocol, LCLIntf, LCLType, SysUtils, Classes, Graphics,
     7  UDpiControls, ScreenTools, BaseWin, Protocol, LCLIntf, LCLType, SysUtils, Classes, Graphics,
    88  Controls, Forms, ButtonB;
    99
     
    3838
    3939uses
    40   Term, ClientTools, Help, Tribes, UDpiControls;
     40  Term, ClientTools, Help, Tribes, UPixelPointer;
    4141
    4242{$R *.lfm}
     
    104104  Ch: Integer;
    105105  Line: array [0..1] of TPixelPointer;
    106 begin
     106  Width: Integer;
     107  Height: Integer;
     108  CenterNative: TPoint;
     109begin
     110  Width := ScaleToVcl(180);
     111  Height := ScaleToVcl(128);
     112  CenterNative := ScalePointtoVcl(Center);
    107113  Offscreen.BeginUpdate;
    108   Line[0].Init(Offscreen);
    109   Line[1].Init(Offscreen);
    110   for Y := 0 to 127 do begin
    111     for X := 0 to 179 do begin
    112       r := X * X * (32 * 32) + Y * Y * (45 * 45);
    113       ax := ((1 shl 16 div 32) * 45) * Y;
    114       if (r < 8 * 128 * 180 * 180) and
    115         ((r >= 32 * 64 * 90 * 90) and (ax < amax2 * X) and
     114  Line[0] := PixelPointer(Offscreen);
     115  Line[1] := PixelPointer(Offscreen);
     116  for Y := 0 to Height - 1 do begin
     117    for X := 0 to Width - 1 do begin
     118      r := X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4));
     119      ax := ((1 shl 16 div (Height div 4)) * (Width div 4)) * Y;
     120      if (r < ScaleToVcl(8) * Height * Width * Width) and
     121        ((r >= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and
    116122        ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and
    117123        ((ax < amax1 * X) or (ax > amin3 * X))) then
    118124        for i := 0 to 1 do
    119125          for ch := 0 to 2 do begin
    120             Line[0].SetXY(Center.X + X, Center.Y + Y);
    121             Line[1].SetXY(Center.X + X, Center.Y - 1 - Y);
     126            Line[0].SetXY(CenterNative.X + X, CenterNative.Y + Y);
     127            Line[1].SetXY(CenterNative.X + X, CenterNative.Y - 1 - Y);
    122128            c := Line[i].Pixel^.Planes[ch] - darken;
    123129            if c < 0 then Line[i].Pixel^.Planes[ch] := 0
    124130              else Line[i].Pixel^.Planes[ch] := c;
    125             Line[0].SetXY(Center.X - 1 - X, Center.Y + Y);
    126             Line[1].SetXY(Center.X - 1 - X, Center.Y - 1 - Y);
     131            Line[0].SetXY(CenterNative.X - 1 - X, CenterNative.Y + Y);
     132            Line[1].SetXY(CenterNative.X - 1 - X, CenterNative.Y - 1 - Y);
    127133            c := Line[i].Pixel^.Planes[ch] - darken;
    128134            if c < 0 then Line[i].Pixel^.Planes[ch] := 0
     
    144150  x0Src := (i mod 7) * xSizeBig;
    145151  y0Src := (i div 7 + SystemIconLines) * ySizeBig;
    146   Src.Init(BigImp, x0Src, y0Src);
    147   Dst.Init(Offscreen, x0Dst, y0Dst);
    148   for Y := 0 to ySizeBig - 1 do begin
    149     for X := 0 to xSizeBig - 1 do begin
     152
     153  Src := PixelPointer(BigImp, ScaleToVcl(x0Src), ScaleToVcl(y0Src));
     154  Dst := PixelPointer(Offscreen, ScaleToVcl(x0Dst), ScaleToVcl(y0Dst));
     155  for Y := 0 to ScaleToVcl(ySizeBig) - 1 do begin
     156    for X := 0 to ScaleToVcl(xSizeBig) - 1 do begin
    150157      Darken := ((255 - Src.Pixel^.B) * 3 + (255 - Src.Pixel^.G) *
    151158        15 + (255 - Src.Pixel^.R) * 9) div 128;
     
    238245    begin
    239246      case MyRO.Wonder[I].CityID of
    240         - 1: // not built yet
     247        -1: // not built yet
    241248          begin
    242249            Fill(Offscreen.Canvas, Center.X - xSizeBig div 2 + RingPosition[I].X - 3,
     
    249256          begin
    250257            HaveWonder := True;
    251             DpiBitBlt(Offscreen.Canvas.Handle,
     258            DpiBitCanvas(Offscreen.Canvas,
    252259              Center.X - xSizeBig div 2 + RingPosition[I].X,
    253260              Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig,
    254               ySizeBig, BigImp.Canvas.Handle, 0, (SystemIconLines + 3) *
    255               ySizeBig, SRCCOPY);
     261              ySizeBig, BigImp.Canvas, 0, (SystemIconLines + 3) *
     262              ySizeBig);
    256263          end;
    257264      else
    258265        begin
    259266          HaveWonder := True;
    260           DpiBitBlt(Offscreen.Canvas.Handle,
     267          DpiBitCanvas(Offscreen.Canvas,
    261268            Center.X - xSizeBig div 2 + RingPosition[I].X,
    262269            Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig, ySizeBig,
    263             BigImp.Canvas.Handle, (I mod 7) * xSizeBig,
    264             (I div 7 + SystemIconLines) * ySizeBig, SRCCOPY);
     270            BigImp.Canvas, (I mod 7) * xSizeBig,
     271            (I div 7 + SystemIconLines) * ySizeBig);
    265272        end;
    266273      end;
Note: See TracChangeset for help on using the changeset viewer.