Changeset 317 for GraphicTest/UDrawMethod.pas
- Timestamp:
- Feb 1, 2012, 3:02:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/UDrawMethod.pas
r212 r317 41 41 TDrawMethodClass = class of TDrawMethod; 42 42 43 { TDummyMethod } 44 45 TDummyMethod = class(TDrawMethod) 46 constructor Create; override; 47 procedure DrawFrame(FastBitmap: TFastBitmap); override; 48 end; 49 43 50 { TCanvasPixels } 44 51 … … 84 91 85 92 TBitmapRawImageDataPaintBox = class(TDrawMethod) 93 constructor Create; override; 94 procedure DrawFrame(FastBitmap: TFastBitmap); override; 95 end; 96 97 { TBitmapRawImageDataMove } 98 99 TBitmapRawImageDataMove = class(TDrawMethod) 86 100 constructor Create; override; 87 101 procedure DrawFrame(FastBitmap: TFastBitmap); override; … … 121 135 122 136 const 123 DrawMethodClasses: array[0.. 8] of TDrawMethodClass = (137 DrawMethodClasses: array[0..10] of TDrawMethodClass = ( 124 138 TCanvasPixels, TCanvasPixelsUpdateLock, TLazIntfImageColorsCopy, 125 139 TLazIntfImageColorsNoCopy, TBitmapRawImageData, TBitmapRawImageDataPaintBox, 126 TBGRABitmapPaintBox, TOpenGLMethod, TOpenGLPBOMethod); 140 TBitmapRawImageDataMove, TBGRABitmapPaintBox, TOpenGLMethod, TOpenGLPBOMethod, 141 TDummyMethod); 127 142 128 143 implementation 144 145 { TDummyMethod } 146 147 constructor TDummyMethod.Create; 148 begin 149 inherited Create; 150 Caption := 'Dummy'; 151 end; 152 153 procedure TDummyMethod.DrawFrame(FastBitmap: TFastBitmap); 154 var 155 Y, X: Integer; 156 PixelPtr: PInteger; 157 RowPtr: PInteger; 158 P: TPixelFormat; 159 RawImage: TRawImage; 160 BytePerPixel: Integer; 161 BytePerRow: Integer; 162 begin 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; 174 end; 175 176 { TBitmapRawImageDataMove } 177 178 constructor TBitmapRawImageDataMove.Create; 179 begin 180 inherited; 181 Caption := 'TBitmap.RawImage.Data Move'; 182 end; 183 184 procedure TBitmapRawImageDataMove.DrawFrame(FastBitmap: TFastBitmap); 185 var 186 Y, X: Integer; 187 PixelPtr: PInteger; 188 RowPtr: PInteger; 189 P: TPixelFormat; 190 RawImage: TRawImage; 191 BytePerPixel: Integer; 192 BytePerRow: Integer; 193 begin 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; 206 end; 129 207 130 208 { TOpenGLPBOMethod } … … 455 533 456 534 procedure TBitmapRawImageData.DrawFrame(FastBitmap: TFastBitmap); 457 type458 TFastBitmapPixelComponents = packed record459 end;460 535 var 461 536 Y, X: Integer;
Note:
See TracChangeset
for help on using the changeset viewer.