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/LocalPlayer/Wonders.pas

    r210 r246  
    8787procedure TWondersDlg.PaintBackgroundShape;
    8888const
    89   darken = 24;
     89  Darken = 24;
    9090  // space=pi/120;
    9191  amax0 = 15734; // 1 shl 16*tan(pi/12-space);
     
    103103  C: Integer;
    104104  Ch: Integer;
    105   Line: array [0..1] of TPixelPointer;
     105  Line: array [0..3] of TPixelPointer;
    106106  Width: Integer;
    107107  Height: Integer;
    108   CenterNative: TPoint;
    109 begin
    110   Width := ScaleToVcl(180);
    111   Height := ScaleToVcl(128);
    112   CenterNative := ScalePointtoVcl(Center);
     108begin
     109  Width := ScaleToNative(180);
     110  Height := ScaleToNative(128);
    113111  Offscreen.BeginUpdate;
    114   Line[0] := PixelPointer(Offscreen);
    115   Line[1] := PixelPointer(Offscreen);
     112  Line[0] := PixelPointer(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y));
     113  Line[1] := PixelPointer(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y) - 1);
     114  Line[2] := PixelPointer(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y));
     115  Line[3] := PixelPointer(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y) - 1);
    116116  for Y := 0 to Height - 1 do begin
    117117    for X := 0 to Width - 1 do begin
    118118      r := X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4));
    119119      ax := ((1 shl 16 div (Height div 4)) * (Width div 4)) * Y;
    120       if (r < ScaleToVcl(8) * Height * Width * Width) and
     120      if (r < ScaleToNative(8) * Height * Width * Width) and
    121121        ((r >= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and
    122122        ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and
    123         ((ax < amax1 * X) or (ax > amin3 * X))) then
    124         for i := 0 to 1 do
    125           for ch := 0 to 2 do begin
    126             Line[0].SetXY(CenterNative.X + X, CenterNative.Y + Y);
    127             Line[1].SetXY(CenterNative.X + X, CenterNative.Y - 1 - Y);
    128             c := Line[i].Pixel^.Planes[ch] - darken;
    129             if c < 0 then Line[i].Pixel^.Planes[ch] := 0
    130               else Line[i].Pixel^.Planes[ch] := c;
    131             Line[0].SetXY(CenterNative.X - 1 - X, CenterNative.Y + Y);
    132             Line[1].SetXY(CenterNative.X - 1 - X, CenterNative.Y - 1 - Y);
    133             c := Line[i].Pixel^.Planes[ch] - darken;
    134             if c < 0 then Line[i].Pixel^.Planes[ch] := 0
    135               else Line[i].Pixel^.Planes[ch] := c;
    136           end;
    137     end;
     123        ((ax < amax1 * X) or (ax > amin3 * X))) then begin
     124        for ch := 0 to 2 do begin
     125          c := Line[0].Pixel^.Planes[ch] - Darken;
     126          if c < 0 then Line[0].Pixel^.Planes[ch] := 0
     127            else Line[0].Pixel^.Planes[ch] := c;
     128          c := Line[1].Pixel^.Planes[ch] - Darken;
     129          if c < 0 then Line[1].Pixel^.Planes[ch] := 0
     130            else Line[1].Pixel^.Planes[ch] := c;
     131          c := Line[2].Pixel^.Planes[ch] - Darken;
     132          if c < 0 then Line[2].Pixel^.Planes[ch] := 0
     133            else Line[2].Pixel^.Planes[ch] := c;
     134          c := Line[3].Pixel^.Planes[ch] - Darken;
     135          if c < 0 then Line[3].Pixel^.Planes[ch] := 0
     136            else Line[3].Pixel^.Planes[ch] := c;
     137        end;
     138      end;
     139      Line[0].NextPixel;
     140      Line[1].NextPixel;
     141      Line[2].PreviousPixel;
     142      Line[3].PreviousPixel;
     143    end;
     144    Line[0].NextLine;
     145    Line[1].PreviousLine;
     146    Line[2].NextLine;
     147    Line[3].PreviousLine;
    138148  end;
    139149  Offscreen.EndUpdate;
     
    150160  x0Src := (i mod 7) * xSizeBig;
    151161  y0Src := (i div 7 + SystemIconLines) * ySizeBig;
    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
     162  Src := PixelPointer(BigImp, ScaleToNative(x0Src), ScaleToNative(y0Src));
     163  Dst := PixelPointer(Offscreen, ScaleToNative(x0Dst), ScaleToNative(y0Dst));
     164  for Y := 0 to ScaleToNative(ySizeBig) - 1 do begin
     165    for X := 0 to ScaleToNative(xSizeBig) - 1 do begin
    157166      Darken := ((255 - Src.Pixel^.B) * 3 + (255 - Src.Pixel^.G) *
    158167        15 + (255 - Src.Pixel^.R) * 9) div 128;
Note: See TracChangeset for help on using the changeset viewer.