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/Help.pas

    r51 r52  
    365365  nHeaven = 28;
    366366  maxsum = 9 * 9 * 255 * 75 div 100;
    367 type
    368   TLine = array [0 .. 649, 0 .. 2] of Byte;
    369367var
    370368  x, y, dx, dy, xSrc, ySrc, sum, xx: integer;
    371369  Heaven: array [0 .. nHeaven] of integer;
    372   PaintLine, CoalLine: ^TLine;
    373   ImpLine: array [-1 .. 1] of ^TLine;
     370  PaintPtr, CoalPtr: TPixelPointer;
     371  ImpPtr: array [-1 .. 1] of TPixelPointer;
    374372begin
    375373  // assume eiffel tower has free common heaven
     
    385383    if (y0 + y >= 0) and (y0 + y < InnerHeight) then
    386384    begin
    387       PaintLine := OffScreen.ScanLine[y0 + y];
    388       CoalLine := Templates.ScanLine[yCoal + y];
     385      PaintPtr.Init(OffScreen, 0, y0 + y);
     386      CoalPtr.Init(Templates, 0, yCoal + y);
    389387      for dy := -1 to 1 do
    390388        if ((y + dy) shr 1 >= 0) and ((y + dy) shr 1 < ySizeBig) then
    391           ImpLine[dy] := BigImp.ScanLine[ySrc + (y + dy) shr 1];
     389          ImpPtr[dy].Init(BigImp, 0, ySrc + (y + dy) shr 1);
    392390      for x := 0 to xSizeBig * 2 - 1 do
    393391      begin
     
    396394        begin
    397395          xx := xSrc + (x + dx) shr 1;
     396          ImpPtr[dy].SetX(xx);
    398397          for dy := -1 to 1 do
    399398            if ((y + dy) shr 1 < 0) or ((y + dy) shr 1 >= ySizeBig) or
    400399              ((x + dx) shr 1 < 0) or ((x + dx) shr 1 >= xSizeBig) or
    401400              ((y + dy) shr 1 < nHeaven) and
    402               (ImpLine[dy, xx, 0] shl 16 + ImpLine[dy, xx, 1] shl 8 +
    403               ImpLine[dy, xx, 2] = Heaven[(y + dy) shr 1]) then
     401              (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 +
     402              ImpPtr[dy].Pixel^.R = Heaven[(y + dy) shr 1]) then
    404403              sum := sum + 9 * 255
    405404            else
    406               sum := sum + ImpLine[dy, xx, 0] + 5 * ImpLine[dy, xx, 1] + 3 *
    407                 ImpLine[dy, xx, 2];
     405              sum := sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
     406                ImpPtr[dy].Pixel^.R;
    408407        end;
    409408        if sum < maxsum then
    410409        begin // no saturation
    411           sum := 1 shl 22 - (maxsum - sum) * (256 - CoalLine[xCoal + x, 0] * 2);
    412           PaintLine[x0 + x, 0] := PaintLine[x0 + x, 0] * sum shr 22;
    413           PaintLine[x0 + x, 1] := PaintLine[x0 + x, 1] * sum shr 22;
    414           PaintLine[x0 + x, 2] := PaintLine[x0 + x, 2] * sum shr 22;
     410          CoalPtr.SetX(xCoal + x);
     411          sum := 1 shl 22 - (maxsum - sum) * (256 - CoalPtr.Pixel^.B * 2);
     412          PaintPtr.SetX(x0 + x);
     413          PaintPtr.Pixel^.B := PaintPtr.Pixel^.B * sum shr 22;
     414          PaintPtr.Pixel^.G := PaintPtr.Pixel^.G * sum shr 22;
     415          PaintPtr.Pixel^.R := PaintPtr.Pixel^.R * sum shr 22;
    415416        end;
    416417      end;
Note: See TracChangeset for help on using the changeset viewer.