Changeset 230 for trunk/Packages


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

Legend:

Unmodified
Added
Removed
  • 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.