Ignore:
Timestamp:
Mar 17, 2011, 9:49:34 AM (14 years ago)
Author:
george
Message:
  • Fixed: RawImage.Data row address calculation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/UDrawMethod.pas

    r202 r203  
    193193  Y, X: Integer;
    194194  PixelPtr: PInteger;
     195  RowPtr: PInteger;
    195196  P: TPixelFormat;
    196197  RawImage: TRawImage;
    197198  BytePerPixel: Integer;
     199  BytePerRow: Integer;
    198200begin
    199201  P := Bitmap.PixelFormat;
     
    202204      Bitmap.BeginUpdate(False);
    203205      RawImage := Bitmap.RawImage;
    204       PixelPtr := PInteger(RawImage.Data);
     206      RowPtr := PInteger(RawImage.Data);
    205207      BytePerPixel := RawImage.Description.BitsPerPixel div 8;
    206       for X := 0 to Size.X - 1 do
    207         for Y := 0 to Size.Y - 1 do begin
     208      BytePerRow := RawImage.Description.BytesPerLine;
     209      for Y := 0 to Size.Y - 1 do begin
     210        PixelPtr := RowPtr;
     211        for X := 0 to Size.X - 1 do begin
    208212          PixelPtr^ := Pixels[X, Y] * $010101;
    209213          Inc(PByte(PixelPtr), BytePerPixel);
    210214        end;
     215        Inc(PByte(RowPtr), BytePerRow);
     216      end;
    211217    finally
    212218      Bitmap.EndUpdate(False);
Note: See TracChangeset for help on using the changeset viewer.