Ignore:
Timestamp:
Jan 15, 2017, 11:47:01 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Unified direct pixel access using TPixelPointer.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Wonders.pas

    r52 r72  
    8282  var
    8383    X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, c: Integer;
    84     Src, Dst: PPixel32;
     84    Src, Dst: TPixelPointer;
    8585  begin
    8686    x0Dst := ClientWidth div 2 - xSizeBig div 2 + RingPosition[i, 0];
     
    8888    x0Src := (i mod 7) * xSizeBig;
    8989    y0Src := (i div 7 + SystemIconLines) * ySizeBig;
     90    Src.Init(BigImp, x0Src, y0Src);
     91    Dst.Init(Offscreen, x0Dst, y0Dst);
    9092    for Y := 0 to ySizeBig - 1 do begin
    9193      for X := 0 to xSizeBig - 1 do begin
    92         Src := GetBitmapPixelPtr(BigImp, x0Src + X, y0Src + Y);
    93         Dst := GetBitmapPixelPtr(Offscreen, x0Dst + X, y0Dst + Y);
    94         darken := ((255 - Src^.B) * 3 + (255 - Src^.G) *
    95           15 + (255 - Src^.R) * 9) div 128;
     94        Darken := ((255 - Src.Pixel^.B) * 3 + (255 - Src.Pixel^.G) *
     95          15 + (255 - Src.Pixel^.R) * 9) div 128;
    9696        for ch := 0 to 2 do begin
    97           c := Dst^.Planes[ch] - darken;
    98           if c < 0 then Dst^.Planes[ch] := 0
    99             else Dst^.Planes[ch] := c;
    100         end
    101       end
     97          c := Dst.Pixel^.Planes[ch] - Darken;
     98          if c < 0 then Dst.Pixel^.Planes[ch] := 0
     99            else Dst.Pixel^.Planes[ch] := c;
     100        end;
     101        Src.NextPixel;
     102        Dst.NextPixel;
     103      end;
     104      Src.NextLine;
     105      Dst.NextLine;
    102106    end;
    103107  end;
     
    122126  i, X, Y, r, ax, ch, c: Integer;
    123127  HaveWonder: boolean;
    124   Line: array [0 .. 1] of PPixel32;
     128  Line: array [0..1] of TPixelPointer;
    125129  s: string;
    126130begin
     
    153157  xm := ClientWidth div 2;
    154158  ym := ClientHeight div 2;
     159  Line[0].Init(Offscreen);
     160  Line[1].Init(Offscreen);
    155161  for Y := 0 to 127 do begin
    156162    for X := 0 to 179 do begin
     
    163169        for i := 0 to 1 do
    164170          for ch := 0 to 2 do begin
    165             Line[0] := GetBitmapPixelPtr(Offscreen, xm + X, ym + Y);
    166             Line[1] := GetBitmapPixelPtr(Offscreen, xm + X, ym - 1 - Y);
    167             c := Line[i]^.Planes[ch] - darken;
    168             if c < 0 then
    169               Line[i]^.Planes[ch] := 0
    170             else
    171               Line[i]^.Planes[ch] := c;
    172             Line[0] := GetBitmapPixelPtr(Offscreen, xm - 1 - X, ym + Y);
    173             Line[1] := GetBitmapPixelPtr(Offscreen, xm - 1 - X, ym - 1 - Y);
    174             c := Line[i]^.Planes[ch] - darken;
    175             if c < 0 then
    176               Line[i]^.Planes[ch] := 0
    177             else
    178               Line[i]^.Planes[ch] := c;
     171            Line[0].SetXY(xm + X, ym + Y);
     172            Line[1].SetXY(xm + X, ym - 1 - Y);
     173            c := Line[i].Pixel^.Planes[ch] - darken;
     174            if c < 0 then Line[i].Pixel^.Planes[ch] := 0
     175              else Line[i].Pixel^.Planes[ch] := c;
     176            Line[0].SetXY(xm - 1 - X, ym + Y);
     177            Line[1].SetXY(xm - 1 - X, ym - 1 - Y);
     178            c := Line[i].Pixel^.Planes[ch] - darken;
     179            if c < 0 then Line[i].Pixel^.Planes[ch] := 0
     180              else Line[i].Pixel^.Planes[ch] := c;
    179181          end;
    180182    end;
Note: See TracChangeset for help on using the changeset viewer.