Changeset 230 for trunk


Ignore:
Timestamp:
May 14, 2020, 10:39:45 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Optimized drawing in Wonders window.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Wonders.pas

    r206 r230  
    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;
    106106begin
    107107  Offscreen.BeginUpdate;
    108   Line[0] := PixelPointer(Offscreen);
    109   Line[1] := PixelPointer(Offscreen);
     108  Line[0] := PixelPointer(Offscreen, Center.X, Center.Y);
     109  Line[1] := PixelPointer(Offscreen, Center.X, Center.Y - 1);
     110  Line[2] := PixelPointer(Offscreen, Center.X - 1, Center.Y);
     111  Line[3] := PixelPointer(Offscreen, Center.X - 1, Center.Y - 1);
    110112  for Y := 0 to 127 do begin
    111113    for X := 0 to 179 do begin
     
    115117        ((r >= 32 * 64 * 90 * 90) and (ax < amax2 * X) and
    116118        ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and
    117         ((ax < amax1 * X) or (ax > amin3 * X))) then
    118         for i := 0 to 1 do
    119           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);
    122             c := Line[i].Pixel^.Planes[ch] - darken;
    123             if c < 0 then Line[i].Pixel^.Planes[ch] := 0
    124               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);
    127             c := Line[i].Pixel^.Planes[ch] - darken;
    128             if c < 0 then Line[i].Pixel^.Planes[ch] := 0
    129               else Line[i].Pixel^.Planes[ch] := c;
    130           end;
    131     end;
     119        ((ax < amax1 * X) or (ax > amin3 * X))) then begin
     120        for ch := 0 to 2 do begin
     121          c := Line[0].Pixel^.Planes[ch] - Darken;
     122          if c < 0 then Line[0].Pixel^.Planes[ch] := 0
     123            else Line[0].Pixel^.Planes[ch] := c;
     124          c := Line[1].Pixel^.Planes[ch] - Darken;
     125          if c < 0 then Line[1].Pixel^.Planes[ch] := 0
     126            else Line[1].Pixel^.Planes[ch] := c;
     127          c := Line[2].Pixel^.Planes[ch] - Darken;
     128          if c < 0 then Line[2].Pixel^.Planes[ch] := 0
     129            else Line[2].Pixel^.Planes[ch] := c;
     130          c := Line[3].Pixel^.Planes[ch] - Darken;
     131          if c < 0 then Line[3].Pixel^.Planes[ch] := 0
     132            else Line[3].Pixel^.Planes[ch] := c;
     133        end;
     134      end;
     135      Line[0].NextPixel;
     136      Line[1].NextPixel;
     137      Line[2].PreviousPixel;
     138      Line[3].PreviousPixel;
     139    end;
     140    Line[0].NextLine;
     141    Line[1].PreviousLine;
     142    Line[2].NextLine;
     143    Line[3].PreviousLine;
    132144  end;
    133145  Offscreen.EndUpdate;
     
    217229              ySizeBig + 6, (wMaintexture - ClientWidth) div 2,
    218230              (hMaintexture - ClientHeight) div 2);
    219             DarkIcon(I);
     231            //DarkIcon(I);
    220232          end;
    221233        -2: // destroyed
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r225 r230  
    911911begin
    912912  dst.BeginUpdate;
    913   DstPtr := PixelPointer(dst, x0, y0);
     913  DstPtr := PixelPointer(dst, x0 - GlowRange + 1, y0 - GlowRange + 1);
    914914  for y := -GlowRange + 1 to Height - 1 + GlowRange - 1 do begin
    915915    for x := -GlowRange + 1 to Width - 1 + GlowRange - 1 do begin
    916       DstPtr.SetXY(x, y);
    917916      if x < 0 then
    918917        if y < 0 then
     
    933932      else if y >= Height then
    934933        r := y - (Height - 1)
    935       else
     934      else begin
     935        DstPtr.NextPixel;
    936936        continue;
     937      end;
    937938      if r = 0 then
    938939        r := 1;
     
    942943            (DstPtr.Pixel^.Planes[2 - ch] * (r - 1) + (cl shr (8 * ch) and $FF) *
    943944            (GlowRange - r)) div (GlowRange - 1);
    944     end;
     945      DstPtr.NextPixel;
     946    end;
     947    DstPtr.NextLine;
    945948  end;
    946949  dst.EndUpdate;
  • trunk/Packages/CevoComponents/UPixelPointer.pas

    r206 r230  
    2727    BytesPerPixel: Integer;
    2828    BytesPerLine: Integer;
    29     procedure NextLine; inline; // Move pointer to start of new base line
     29    procedure NextLine; inline; // Move pointer to start of next line
     30    procedure PreviousLine; inline; // Move pointer to start of previous line
    3031    procedure NextPixel; inline; // Move pointer to next pixel
     32    procedure PreviousPixel; inline; // Move pointer to previous pixel
    3133    procedure SetXY(X, Y: Integer); inline; // Set pixel position relative to base
    3234    procedure SetX(X: Integer); inline; // Set horizontal pixel position relative to base
     
    4749end;
    4850
     51procedure TPixelPointer.PreviousLine;
     52begin
     53  Line := Pointer(Line) - BytesPerLine;
     54  Pixel := Line;
     55end;
     56
    4957procedure TPixelPointer.NextPixel; inline;
    5058begin
    5159  Pixel := Pointer(Pixel) + BytesPerPixel;
     60end;
     61
     62procedure TPixelPointer.PreviousPixel;
     63begin
     64  Pixel := Pointer(Pixel) - BytesPerPixel;
    5265end;
    5366
Note: See TracChangeset for help on using the changeset viewer.