Changeset 203 for GraphicTest


Ignore:
Timestamp:
Mar 17, 2011, 9:49:34 AM (13 years ago)
Author:
george
Message:
  • Fixed: RawImage.Data row address calculation.
Location:
GraphicTest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/GraphicTest.lpi

    r202 r203  
    5555        <ResourceBaseClass Value="Form"/>
    5656        <UnitName Value="UMainForm"/>
    57         <IsVisibleTab Value="True"/>
    5857        <EditorIndex Value="0"/>
    5958        <WindowIndex Value="0"/>
    60         <TopLine Value="107"/>
    61         <CursorPos X="1" Y="122"/>
     59        <TopLine Value="1"/>
     60        <CursorPos X="27" Y="38"/>
    6261        <UsageCount Value="32"/>
    6362        <Loaded Value="True"/>
     
    182181        <IsPartOfProject Value="True"/>
    183182        <UnitName Value="UDrawMethod"/>
     183        <IsVisibleTab Value="True"/>
    184184        <EditorIndex Value="6"/>
    185185        <WindowIndex Value="0"/>
    186         <TopLine Value="1"/>
    187         <CursorPos X="33" Y="15"/>
     186        <TopLine Value="196"/>
     187        <CursorPos X="10" Y="206"/>
    188188        <UsageCount Value="26"/>
    189189        <Loaded Value="True"/>
     
    236236        <TopLine Value="584"/>
    237237        <CursorPos X="3" Y="597"/>
    238         <UsageCount Value="10"/>
     238        <UsageCount Value="11"/>
    239239        <Loaded Value="True"/>
    240240      </Unit22>
     
    392392      <Position29>
    393393        <Filename Value="UDrawMethod.pas"/>
    394         <Caret Line="179" Column="22" TopLine="164"/>
     394        <Caret Line="211" Column="28" TopLine="196"/>
    395395      </Position29>
    396396    </JumpHistory>
  • 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.