Changeset 501 for trunk/Packages/DpiControls
- Timestamp:
- Dec 23, 2023, 11:11:19 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/DpiControls/Dpi.PixelPointer.pas
r487 r501 4 4 5 5 uses 6 Classes, SysUtils, Dpi.Graphics, Dpi.Common;6 Math, Classes, SysUtils, Dpi.Graphics, Dpi.Common; 7 7 8 8 type … … 68 68 69 69 resourcestring 70 SOutOfRange = 'Pixel pointer out of range ';70 SOutOfRange = 'Pixel pointer out of range [X: %d. Y: %d]'; 71 71 SWrongBitmapSize = 'Wrong bitmap size [width: %d, height: %d]'; 72 72 … … 126 126 127 127 procedure TPixelPointer.CheckRange; 128 var 129 X: Integer; 130 Y: Integer; 128 131 begin 129 132 {$IFOPT R+} 130 133 if (PByte(Pixel) < PByte(Data)) or 131 (PByte(Pixel) >= PByte(Data) + (Width + Height * BytesPerLine) * BytesPerPixel) then 132 raise Exception.Create(SOutOfRange); 134 (PByte(Pixel) >= PByte(Data) + Height * BytesPerLine + BytesPerLine) then begin 135 X := PByte(Pixel) - PByte(Data); 136 Y := Floor(X / BytesPerLine); 137 X := X - Y * BytesPerLine; 138 X := Floor(X / BytesPerPixel); 139 raise Exception.Create(Format(SOutOfRange, [X, Y])); 140 end; 133 141 {$ENDIF} 134 142 end;
Note:
See TracChangeset
for help on using the changeset viewer.