Changeset 206


Ignore:
Timestamp:
May 8, 2020, 6:12:35 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Remove warnings about uninitialized TPixelPointer variables. Initialize that types using PixelPointer function in similar way how TPoint is inicialized using Point function.
Location:
trunk
Files:
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r205 r206  
    9090
    9191uses
    92   Select, Messg, MessgEx, Help, Tribes, Directories, Math, PixelPointer, Sound;
     92  Select, Messg, MessgEx, Help, Tribes, Directories, Math, UPixelPointer, Sound;
    9393
    9494{$R *.lfm}
     
    443443  begin
    444444    Offscreen.BeginUpdate;
    445     PixelPtr.Init(Offscreen, X, Y);
     445    PixelPtr := PixelPointer(Offscreen, X, Y);
    446446    for YY := 0 to H - 1 do begin
    447447      for XX := 0 to W - 1 do begin
  • trunk/LocalPlayer/Help.pas

    r205 r206  
    127127
    128128uses
    129   Directories, ClientTools, Term, Tribes, Inp, Messg, PixelPointer, Global;
     129  Directories, ClientTools, Term, Tribes, Inp, Messg, UPixelPointer, Global;
    130130
    131131{$R *.lfm}
     
    459459  for y := 0 to ySizeBig * 2 - 1 do
    460460    if ((y0 + y) >= 0) and ((y0 + y) < InnerHeight) then begin
    461       PaintPtr.Init(OffScreen, 0, y0 + y);
    462       CoalPtr.Init(Templates, 0, yCoal + y);
     461      PaintPtr := PixelPointer(OffScreen, 0, y0 + y);
     462      CoalPtr := PixelPointer(Templates, 0, yCoal + y);
    463463      for dy := -1 to 1 do
    464464        if ((Max(y + dy, 0) shr 1) >= 0) and ((Max(y + dy, 0) shr 1) < ySizeBig) then
    465           ImpPtr[dy].Init(BigImp, 0, ySrc + (Max(y + dy, 0) shr 1));
     465          ImpPtr[dy] := PixelPointer(BigImp, 0, ySrc + (Max(y + dy, 0) shr 1));
    466466      for x := 0 to xSizeBig * 2 - 1 do begin
    467467        sum := 0;
  • trunk/LocalPlayer/IsoEngine.pas

    r189 r206  
    66uses
    77  Protocol, ClientTools, ScreenTools, Tribes, {$IFNDEF SCR}Term, {$ENDIF}
    8   LCLIntf, LCLType, SysUtils, Classes, Graphics, PixelPointer;
     8  LCLIntf, LCLType, SysUtils, Classes, Graphics, UPixelPointer;
    99
    1010type
     
    375375  begin
    376376    for i := 0 to yyt * 3 - 1 do
    377       MaskLine[i].Init(Mask24, 0, 1 + ySrc * (yyt * 3 + 1) + i);
     377      MaskLine[i] := PixelPointer(Mask24, 0, 1 + ySrc * (yyt * 3 + 1) + i);
    378378    for xSrc := 0 to 9 - 1 do
    379379    begin
     
    10171017          for dy := 0 to yyt * 2 - 1 do
    10181018          begin
    1019             PixelPtr.Init(Borders, 0, p1 * (yyt * 2) + dy);
     1019            PixelPtr := PixelPointer(Borders, 0, p1 * (yyt * 2) + dy);
    10201020            for dx := 0 to xxt * 2 - 1 do begin
    10211021              if PixelPtr.Pixel^.B = 99 then begin
     
    13401340  FOutput.BeginUpdate;
    13411341  for y := y0 to y1 - 1 do begin
    1342     Line.Init(FOutput, 0, y);
     1342    Line := PixelPointer(FOutput, 0, y);
    13431343    y_n := (y - ym) / yyt;
    13441344    if abs(y_n) < rShade then begin
  • trunk/LocalPlayer/MessgEx.pas

    r190 r206  
    7373
    7474uses
    75   ClientTools, BaseWin, Term, Help, UnitStat, Tribes, PixelPointer,
     75  ClientTools, BaseWin, Term, Help, UnitStat, Tribes, UPixelPointer,
    7676  IsoEngine, Diagram, Sound;
    7777
     
    246246    for iy := 0 to 39 do begin
    247247      for ix := 0 to 55 do begin
    248         SrcPtr.Init(BigImp, ix + xIcon, iy + yIcon);
     248        SrcPtr := PixelPointer(BigImp, ix + xIcon, iy + yIcon);
    249249        xR := ix * (37 + iy * 5 / 40) / 56;
    250250        xDst := Trunc(xR);
  • trunk/LocalPlayer/Term.pas

    r205 r206  
    481481uses
    482482  Directories, IsoEngine, CityScreen, Draft, MessgEx, Select, CityType, Help,
    483   UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, PixelPointer, Sound,
     483  UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, UPixelPointer, Sound,
    484484  Battle, Rates, TechTree, Registry, Global;
    485485
     
    577577        if ydivider > ySizeSmall then
    578578          ydivider := ySizeSmall;
    579         PixelPtr.Init(BigImp, 0, cut + iy * ySizeBig + y);
     579        PixelPtr := PixelPointer(BigImp, 0, cut + iy * ySizeBig + y);
    580580        for x := 0 to xSizeBig - 1 do
    581581        begin
     
    610610  SmallImp.BeginUpdate;
    611611  for y := 0 to ny - 1 do begin
    612     PixelPtr.Init(SmallImp, 0, y);
     612    PixelPtr := PixelPointer(SmallImp, 0, y);
    613613    for x := 0 to nx - 1 do
    614614      for ch := 0 to 2 do begin
     
    40754075  end;
    40764076  Mini.BeginUpdate;
    4077   MiniPixel.Init(Mini);
    4078   PrevMiniPixel.Init(Mini);
     4077  MiniPixel := PixelPointer(Mini);
     4078  PrevMiniPixel := PixelPointer(Mini);
    40794079  for y := 0 to G.ly - 1 do
    40804080  begin
  • trunk/LocalPlayer/Wonders.pas

    r188 r206  
    3838
    3939uses
    40   Term, ClientTools, Help, Tribes, PixelPointer;
     40  Term, ClientTools, Help, Tribes, UPixelPointer;
    4141
    4242{$R *.lfm}
     
    106106begin
    107107  Offscreen.BeginUpdate;
    108   Line[0].Init(Offscreen);
    109   Line[1].Init(Offscreen);
     108  Line[0] := PixelPointer(Offscreen);
     109  Line[1] := PixelPointer(Offscreen);
    110110  for Y := 0 to 127 do begin
    111111    for X := 0 to 179 do begin
     
    144144  x0Src := (i mod 7) * xSizeBig;
    145145  y0Src := (i div 7 + SystemIconLines) * ySizeBig;
    146   Src.Init(BigImp, x0Src, y0Src);
    147   Dst.Init(Offscreen, x0Dst, y0Dst);
     146  Src := PixelPointer(BigImp, x0Src, y0Src);
     147  Dst := PixelPointer(Offscreen, x0Dst, y0Dst);
    148148  for Y := 0 to ySizeBig - 1 do begin
    149149    for X := 0 to xSizeBig - 1 do begin
  • trunk/Packages/CevoComponents/CevoComponents.lpk

    r170 r206  
    9999      </Item13>
    100100      <Item14>
    101         <Filename Value="PixelPointer.pas"/>
    102         <UnitName Value="PixelPointer"/>
     101        <Filename Value="UPixelPointer.pas"/>
     102        <UnitName Value="UPixelPointer"/>
    103103      </Item14>
    104104    </Files>
  • trunk/Packages/CevoComponents/CevoComponents.pas

    r170 r206  
    1010uses
    1111  Area, ButtonA, ButtonB, ButtonC, ButtonN, EOTButton, ButtonBase, DrawDlg,
    12   Sound, BaseWin, PixelPointer, LazarusPackageIntf;
     12  Sound, BaseWin, UPixelPointer, LazarusPackageIntf;
    1313
    1414implementation
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r205 r206  
    208208
    209209uses
    210   Directories, Sound, PixelPointer;
     210  Directories, Sound, UPixelPointer;
    211211
    212212var
     
    360360begin
    361361  Bitmap.BeginUpdate;
    362   PixelPtr.Init(Bitmap);
     362  PixelPtr := PixelPointer(Bitmap);
    363363  for Y := 0 to Bitmap.Height - 1 do begin
    364364    for X := 0 to Bitmap.Width - 1 do begin
     
    377377begin
    378378  //Dst.SetSize(Src.Width, Src.Height);
    379   SrcPtr.Init(Src);
    380   DstPtr.Init(Dst);
     379  SrcPtr := PixelPointer(Src);
     380  DstPtr := PixelPointer(Dst);
    381381  for Y := 0 to Src.Height - 1 do begin
    382382    for X := 0 to Src.Width - 1 do begin
     
    501501    GrExt[nGrExt].Data.BeginUpdate;
    502502    GrExt[nGrExt].Mask.BeginUpdate;
    503     DataPixel.Init(GrExt[nGrExt].Data);
    504     MaskPixel.Init(GrExt[nGrExt].Mask);
     503    DataPixel := PixelPointer(GrExt[nGrExt].Data);
     504    MaskPixel := PixelPointer(GrExt[nGrExt].Mask);
    505505    for y := 0 to Source.Height - 1 do begin
    506506      for x := 0 to xmax - 1 do begin
     
    542542begin
    543543  Dst.BeginUpdate;
    544   PixelPtr.Init(Dst, X, Y);
     544  PixelPtr := PixelPointer(Dst, X, Y);
    545545  for yy := 0 to Height - 1 do begin
    546546    for xx := 0 to Width - 1 do begin
     
    585585  dst.BeginUpdate;
    586586  Src.BeginUpdate;
    587   PixelDst.Init(Dst, xDst, yDst);
    588   PixelSrc.Init(Src, xSrc, ySrc);
     587  PixelDst := PixelPointer(Dst, xDst, yDst);
     588  PixelSrc := PixelPointer(Src, xSrc, ySrc);
    589589  for Y := 0 to h - 1 do begin
    590590    for X := 0 to w - 1 do  begin
     
    644644  Src.BeginUpdate;
    645645  dst.BeginUpdate;
    646   SrcPixel.Init(Src, xSrc, ySrc);
    647   DstPixel.Init(Dst, xDst, yDst);
     646  SrcPixel := PixelPointer(Src, xSrc, ySrc);
     647  DstPixel := PixelPointer(Dst, xDst, yDst);
    648648  for iy := 0 to Height - 1 do begin
    649649    for ix := 0 to Width - 1 do begin
     
    687687  assert(bmp.PixelFormat = pf24bit);
    688688  h := y + h;
    689   PixelPtr.Init(Bmp, x, y);
     689  PixelPtr := PixelPointer(Bmp, x, y);
    690690  while y < h do begin
    691691    for i := 0 to w - 1 do begin
     
    837837begin
    838838  dst.BeginUpdate;
    839   DstPtr.Init(dst, x0, y0);
     839  DstPtr := PixelPointer(dst, x0, y0);
    840840  for y := -GlowRange + 1 to Height - 1 + GlowRange - 1 do begin
    841841    for x := -GlowRange + 1 to Width - 1 + GlowRange - 1 do begin
     
    14331433  TexWidth := Texture.Width;
    14341434  TexHeight := Texture.Height;
    1435   DstPixel.Init(Dest);
    1436   SrcPixel.Init(Texture);
     1435  DstPixel := PixelPointer(Dest);
     1436  SrcPixel := PixelPointer(Texture);
    14371437  for Y := 0 to Dest.Height - 1 do begin
    14381438    for X := 0 to Dest.Width - 1 do begin
     
    14561456begin
    14571457  Bitmap.BeginUpdate;
    1458   PicturePixel.Init(Bitmap);
     1458  PicturePixel := PixelPointer(Bitmap);
    14591459  for y := 0 to Bitmap.Height - 1 do begin
    14601460    for x := 0 to Bitmap.Width - 1 do begin
  • trunk/Packages/CevoComponents/UPixelPointer.pas

    r205 r206  
    1 unit PixelPointer;
     1unit UPixelPointer;
    22
    33interface
     
    3131    procedure SetXY(X, Y: Integer); inline; // Set pixel position relative to base
    3232    procedure SetX(X: Integer); inline; // Set horizontal pixel position relative to base
    33     procedure Init(Bitmap: TRasterImage; BaseX: Integer = 0; BaseY: Integer = 0); inline;
    3433  end;
    3534  PPixelPointer = ^TPixelPointer;
     35
     36  function PixelPointer(Bitmap: TRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline;
    3637
    3738
     
    6263end;
    6364
    64 procedure TPixelPointer.Init(Bitmap: TRasterImage; BaseX: Integer = 0;
    65   BaseY: Integer = 0); inline;
     65function PixelPointer(Bitmap: TRasterImage; BaseX: Integer;
     66  BaseY: Integer): TPixelPointer;
    6667begin
    67   BytesPerLine := Bitmap.RawImage.Description.BytesPerLine;
    68   BytesPerPixel := Bitmap.RawImage.Description.BitsPerPixel shr 3;
    69   Base := PPixel32(Bitmap.RawImage.Data + BaseX * BytesPerPixel + BaseY * BytesPerLine);
    70   SetXY(0, 0);
     68  Result.BytesPerLine := Bitmap.RawImage.Description.BytesPerLine;
     69  Result.BytesPerPixel := Bitmap.RawImage.Description.BitsPerPixel shr 3;
     70  Result.Base := PPixel32(Bitmap.RawImage.Data + BaseX * Result.BytesPerPixel +
     71    BaseY * Result.BytesPerLine);
     72  Result.SetXY(0, 0);
    7173end;
    7274
  • trunk/Start.pas

    r198 r206  
    165165
    166166uses
    167   Global, Directories, Direct, ScreenTools, Inp, Back, Locale, PixelPointer;
     167  Global, Directories, Direct, ScreenTools, Inp, Back, Locale, UPixelPointer;
    168168
    169169{$R *.lfm}
     
    354354  Bitmap.SetSize(Size.X * 2, Size.Y);
    355355  Bitmap.BeginUpdate;
    356   MiniPixel.Init(Bitmap);
     356  MiniPixel := PixelPointer(Bitmap);
    357357  for y := 0 to Size.Y - 1 do begin
    358358    for x := 0 to Size.X - 1 do begin
     
    386386  if Mode = mmPicture then begin
    387387    Bitmap.BeginUpdate;
    388     MiniPixel.Init(Bitmap);
    389     PrevMiniPixel.Init(Bitmap, 0, -1);
     388    MiniPixel := PixelPointer(Bitmap);
     389    PrevMiniPixel := PixelPointer(Bitmap, 0, -1);
    390390    for y := 0 to Size.Y - 1 do begin
    391391      for x := 0 to Size.X - 1 do begin
Note: See TracChangeset for help on using the changeset viewer.