Ignore:
Timestamp:
Jan 11, 2017, 10:14:11 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: More Bitmap.ScanLine replaced by direct access to RAWImage data.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Wonders.pas

    r38 r52  
    7878
    7979procedure TWondersDlg.OffscreenPaint;
    80 type
    81   TLine = array [0 .. 649, 0 .. 2] of Byte;
    8280
    8381  procedure DarkIcon(i: Integer);
    8482  var
    8583    X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, c: Integer;
    86     Src, Dst: ^TLine;
     84    Src, Dst: PPixel32;
    8785  begin
    8886    x0Dst := ClientWidth div 2 - xSizeBig div 2 + RingPosition[i, 0];
     
    9088    x0Src := (i mod 7) * xSizeBig;
    9189    y0Src := (i div 7 + SystemIconLines) * ySizeBig;
    92     for Y := 0 to ySizeBig - 1 do
    93     begin
    94       Src := BigImp.ScanLine[y0Src + Y];
    95       Dst := Offscreen.ScanLine[y0Dst + Y];
    96       for X := 0 to xSizeBig - 1 do
    97       begin
    98         darken := ((255 - Src[x0Src + X][0]) * 3 + (255 - Src[x0Src + X][1]) *
    99           15 + (255 - Src[x0Src + X][2]) * 9) div 128;
    100         for ch := 0 to 2 do
    101         begin
    102           c := Dst[x0Dst + X][ch] - darken;
    103           if c < 0 then
    104             Dst[x0Dst + X][ch] := 0
    105           else
    106             Dst[x0Dst + X][ch] := c;
     90    for Y := 0 to ySizeBig - 1 do begin
     91      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;
     96        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;
    107100        end
    108101      end
     
    129122  i, X, Y, r, ax, ch, c: Integer;
    130123  HaveWonder: boolean;
    131   Line: array [0 .. 1] of ^TLine;
     124  Line: array [0 .. 1] of PPixel32;
    132125  s: string;
    133126begin
     
    160153  xm := ClientWidth div 2;
    161154  ym := ClientHeight div 2;
    162   for Y := 0 to 127 do
    163   begin
    164     Line[0] := Offscreen.ScanLine[ym + Y];
    165     Line[1] := Offscreen.ScanLine[ym - 1 - Y];
    166     for X := 0 to 179 do
    167     begin
     155  for Y := 0 to 127 do begin
     156    for X := 0 to 179 do begin
    168157      r := X * X * (32 * 32) + Y * Y * (45 * 45);
    169158      ax := ((1 shl 16 div 32) * 45) * Y;
     
    173162        ((ax < amax1 * X) or (ax > amin3 * X))) then
    174163        for i := 0 to 1 do
    175           for ch := 0 to 2 do
    176           begin
    177             c := Line[i][xm + X][ch] - darken;
     164          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;
    178168            if c < 0 then
    179               Line[i][xm + X][ch] := 0
     169              Line[i]^.Planes[ch] := 0
    180170            else
    181               Line[i][xm + X][ch] := c;
    182             c := Line[i][xm - 1 - X][ch] - darken;
     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;
    183175            if c < 0 then
    184               Line[i][xm - 1 - X][ch] := 0
     176              Line[i]^.Planes[ch] := 0
    185177            else
    186               Line[i][xm - 1 - X][ch] := c;
     178              Line[i]^.Planes[ch] := c;
    187179          end;
    188180    end;
Note: See TracChangeset for help on using the changeset viewer.