Ignore:
Timestamp:
Feb 1, 2012, 3:02:33 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Updated BGRABitmap package to version 5.5.
  • Modified: Removed draw method ComboBox and reorganized method list to single listview with using ownerdraw facility.
  • Added: New draw method TBitmap.RawImage.Data Move which use fast Move operation. It requires same pixel format.
  • Added: New draw method Dummy for comparion of empty method and to determine possibily max frame rate limit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/UDrawMethod.pas

    r212 r317  
    4141  TDrawMethodClass = class of TDrawMethod;
    4242
     43  { TDummyMethod }
     44
     45  TDummyMethod = class(TDrawMethod)
     46    constructor Create; override;
     47    procedure DrawFrame(FastBitmap: TFastBitmap); override;
     48  end;
     49
    4350  { TCanvasPixels }
    4451
     
    8491
    8592  TBitmapRawImageDataPaintBox = class(TDrawMethod)
     93    constructor Create; override;
     94    procedure DrawFrame(FastBitmap: TFastBitmap); override;
     95  end;
     96
     97  { TBitmapRawImageDataMove }
     98
     99  TBitmapRawImageDataMove = class(TDrawMethod)
    86100    constructor Create; override;
    87101    procedure DrawFrame(FastBitmap: TFastBitmap); override;
     
    121135
    122136const
    123   DrawMethodClasses: array[0..8] of TDrawMethodClass = (
     137  DrawMethodClasses: array[0..10] of TDrawMethodClass = (
    124138    TCanvasPixels, TCanvasPixelsUpdateLock, TLazIntfImageColorsCopy,
    125139    TLazIntfImageColorsNoCopy, TBitmapRawImageData, TBitmapRawImageDataPaintBox,
    126     TBGRABitmapPaintBox, TOpenGLMethod, TOpenGLPBOMethod);
     140    TBitmapRawImageDataMove, TBGRABitmapPaintBox, TOpenGLMethod, TOpenGLPBOMethod,
     141    TDummyMethod);
    127142
    128143implementation
     144
     145{ TDummyMethod }
     146
     147constructor TDummyMethod.Create;
     148begin
     149  inherited Create;
     150  Caption := 'Dummy';
     151end;
     152
     153procedure TDummyMethod.DrawFrame(FastBitmap: TFastBitmap);
     154var
     155  Y, X: Integer;
     156  PixelPtr: PInteger;
     157  RowPtr: PInteger;
     158  P: TPixelFormat;
     159  RawImage: TRawImage;
     160  BytePerPixel: Integer;
     161  BytePerRow: Integer;
     162begin
     163  P := Bitmap.PixelFormat;
     164    with FastBitmap do
     165    try
     166      //Bitmap.BeginUpdate(False);
     167      RawImage := Bitmap.RawImage;
     168      RowPtr := PInteger(RawImage.Data);
     169      BytePerPixel := RawImage.Description.BitsPerPixel div 8;
     170      BytePerRow := RawImage.Description.BytesPerLine;
     171    finally
     172      //Bitmap.EndUpdate(False);
     173    end;
     174end;
     175
     176{ TBitmapRawImageDataMove }
     177
     178constructor TBitmapRawImageDataMove.Create;
     179begin
     180  inherited;
     181  Caption := 'TBitmap.RawImage.Data Move';
     182end;
     183
     184procedure TBitmapRawImageDataMove.DrawFrame(FastBitmap: TFastBitmap);
     185var
     186  Y, X: Integer;
     187  PixelPtr: PInteger;
     188  RowPtr: PInteger;
     189  P: TPixelFormat;
     190  RawImage: TRawImage;
     191  BytePerPixel: Integer;
     192  BytePerRow: Integer;
     193begin
     194  P := Bitmap.PixelFormat;
     195    with FastBitmap do
     196    try
     197      Bitmap.BeginUpdate(False);
     198      RawImage := Bitmap.RawImage;
     199      RowPtr := PInteger(RawImage.Data);
     200      BytePerPixel := RawImage.Description.BitsPerPixel div 8;
     201      BytePerRow := RawImage.Description.BytesPerLine;
     202      Move(FastBitmap.PixelsData^, RowPtr^, Size.Y * BytePerRow);
     203    finally
     204      Bitmap.EndUpdate(False);
     205    end;
     206end;
    129207
    130208{ TOpenGLPBOMethod }
     
    455533
    456534procedure TBitmapRawImageData.DrawFrame(FastBitmap: TFastBitmap);
    457 type
    458   TFastBitmapPixelComponents = packed record
    459   end;
    460535var
    461536  Y, X: Integer;
Note: See TracChangeset for help on using the changeset viewer.