Changeset 29 for trunk/ScreenTools.pas


Ignore:
Timestamp:
Jan 8, 2017, 10:20:03 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Use DirectorySeparator in directory path for platform independence.
  • Fixed: Some warining about incorrect pointer arithmetic.
  • Added: Support for multi-platform AI library name and location.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1111lib
        1212heaptrclog.trc
         13c-evo
  • trunk/ScreenTools.pas

    r28 r29  
    99  {$ENDIF}
    1010  StringTables,
    11   LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls,
     11  LCLIntf, LCLType, LMessages, Messages, SysUtils, Classes, Graphics, Controls,
    1212  Forms, Menus;
    1313
     
    192192
    193193uses
    194   Directories, Sound, Registry;
     194  Directories, Sound, ButtonBase, ButtonA, ButtonB,
     195
     196  Registry;
    195197
    196198var
     
    384386procedure ApplyGamma(Start, Stop: pbyte);
    385387begin
    386   while Start < Stop do
     388  while integer(Start) < integer(Stop) do
    387389  begin
    388390    Start^ := GammaLUT[Start^];
     
    442444    FirstLine := bmp.ScanLine[0];
    443445    LastLine := bmp.ScanLine[bmp.Height - 1];
    444     if FirstLine < LastLine then
     446    if integer(FirstLine) < integer(LastLine) then
    445447      ApplyGamma(pointer(FirstLine), @LastLine[bmp.Width])
    446448    else
     
    502504    FirstLine := bmp.ScanLine[0];
    503505    LastLine := bmp.ScanLine[bmp.Height - 1];
    504     if FirstLine < LastLine then
     506    if integer(FirstLine) < integer(LastLine) then
    505507      ApplyGamma(pointer(FirstLine), @LastLine[bmp.Width])
    506508    else
     
    620622// X channel = background amp (old Dst content), 128=original brightness
    621623type
    622   TPixel = array [0..2] of Byte;
    623   PPixel = ^TPixel;
     624  TPixel = array [0 .. 2] of Byte;
    624625var
    625626  i, Brightness, test: integer;
    626627  PixelSrc: ^Byte;
    627   PixelDst: PPixel;
     628  PixelDst: ^TPixel;
    628629begin
    629630  {TODO assert(Src.PixelFormat = pf8bit);}
     
    652653  while yDst < h do
    653654  begin
    654     PixelDst := dst.ScanLine[yDst] + 3 * xDst;
    655     PixelSrc := Src.ScanLine[ySrc] + xSrc;
     655    PixelDst := pointer(integer(dst.ScanLine[yDst]) + 3 * xDst);
     656    PixelSrc := pointer(integer(Src.ScanLine[ySrc]) + xSrc);
    656657    for i := 0 to w - 1 do
    657658    begin
     
    672673      else
    673674        PixelDst[0] := test; // Blue
    674       PixelDst := Pointer(PixelDst) + 3;
    675       PixelSrc := Pointer(PixelSrc) + 1;
     675      PixelDst := pointer(integer(PixelDst) + 3);
     676      PixelSrc := pointer(integer(PixelSrc) + 1);
    676677    end;
    677678    inc(yDst);
     
    763764  while y < h do
    764765  begin
    765     Pixel := bmp.ScanLine[y] + 3 * x;
     766    Pixel := pointer(integer(bmp.ScanLine[y]) + 3 * x);
    766767    for i := 0 to w - 1 do
    767768    begin
     
    776777      Pixel[1] := Green;
    777778      Pixel[2] := Red;
    778       Pixel := Pointer(Pixel) + 3;
     779      Pixel := pointer(integer(Pixel) + 3);
    779780    end;
    780781    inc(y);
Note: See TracChangeset for help on using the changeset viewer.