Ignore:
Timestamp:
May 8, 2020, 6:12:35 PM (4 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.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.