Changeset 442 for GraphicTest/UDrawMethod.pas
- Timestamp:
- Nov 22, 2012, 9:37:20 AM (12 years ago)
- Location:
- GraphicTest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest
- Property svn:ignore
-
old new 7 7 GraphicTest.rc 8 8 GraphicTest.lps 9 GraphicTest.dbg
-
- Property svn:ignore
-
GraphicTest/UDrawMethod.pas
r356 r442 1 1 unit UDrawMethod; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface 6 6 7 7 uses 8 Classes, SysUtils, StdCtrls,ExtCtrls, UPlatform, UFastBitmap, Graphics,8 Classes, SysUtils, ExtCtrls, UPlatform, UFastBitmap, Graphics, 9 9 LCLType, IntfGraphics, fpImage, GraphType, BGRABitmap, BGRABitmapTypes, 10 LclIntf , GL, GLExt, OpenGLContext;10 LclIntf{$IFDEF opengl}, GL, GLExt, OpenGLContext{$ENDIF}; 11 11 12 12 type … … 29 29 StepDuration: TDateTime; 30 30 PaintObject: TPaintObject; 31 {$IFDEF opengl} 31 32 OpenGLBitmap: Pointer; 32 33 OpenGLControl: TOpenGLControl; 33 34 TextureId: GLuint; 35 {$ENDIF} 34 36 procedure Init; virtual; 35 37 constructor Create; virtual; … … 114 116 end; 115 117 118 {$IFDEF opengl} 116 119 { TOpenGLMethod } 117 120 … … 135 138 procedure DrawFrame(FastBitmap: TFastBitmap); override; 136 139 end; 140 {$ENDIF} 137 141 138 142 const 139 DrawMethodClasses: array[0.. 10] of TDrawMethodClass = (143 DrawMethodClasses: array[0..{$IFDEF opengl}10{$ELSE}8{$ENDIF}] of TDrawMethodClass = ( 140 144 TCanvasPixels, TCanvasPixelsUpdateLock, TLazIntfImageColorsCopy, 141 145 TLazIntfImageColorsNoCopy, TBitmapRawImageData, TBitmapRawImageDataPaintBox, 142 TBitmapRawImageDataMove, TBGRABitmapPaintBox , TOpenGLMethod, TOpenGLPBOMethod,143 TDummyMethod);146 TBitmapRawImageDataMove, TBGRABitmapPaintBox{$IFDEF opengl}, TOpenGLMethod, TOpenGLPBOMethod{$ENDIF} 147 ,TDummyMethod); 144 148 145 149 implementation … … 208 212 end; 209 213 214 {$IFDEF opengl} 210 215 { TOpenGLPBOMethod } 211 216 … … 435 440 end; 436 441 442 {$ENDIF} 443 437 444 { TBGRABitmapPaintBox } 438 445 … … 460 467 var 461 468 X, Y: Integer; 462 P: P Integer;469 P: PCardinal; 463 470 begin 464 471 with FastBitmap do 465 472 for Y := 0 to Size.Y - 1 do begin 466 P := P Integer(BGRABitmap.ScanLine[Y]);473 P := PCardinal(BGRABitmap.ScanLine[Y]); 467 474 for X := 0 to Size.X - 1 do begin 468 475 P^ := NoSwapBRComponent(Pixels[X, Y]) or $ff000000; … … 492 499 var 493 500 Y, X: Integer; 494 PixelPtr: P Integer;495 RowPtr: P Integer;501 PixelPtr: PCardinal; 502 RowPtr: PCardinal; 496 503 P: TPixelFormat; 497 504 RawImage: TRawImage; … … 505 512 TempBitmap.BeginUpdate(False); 506 513 RawImage := TempBitmap.RawImage; 507 RowPtr := P Integer(RawImage.Data);514 RowPtr := PCardinal(RawImage.Data); 508 515 BytePerPixel := RawImage.Description.BitsPerPixel div 8; 509 516 BytePerRow := RawImage.Description.BytesPerLine; … … 538 545 var 539 546 Y, X: Integer; 540 PixelPtr: P Integer;541 RowPtr: P Integer;547 PixelPtr: PCardinal; 548 RowPtr: PCardinal; 542 549 P: TPixelFormat; 543 550 RawImage: TRawImage; … … 550 557 Bitmap.BeginUpdate(False); 551 558 RawImage := Bitmap.RawImage; 552 RowPtr := P Integer(RawImage.Data);559 RowPtr := PCardinal(RawImage.Data); 553 560 BytePerPixel := RawImage.Description.BitsPerPixel div 8; 554 561 BytePerRow := RawImage.Description.BytesPerLine; … … 643 650 try 644 651 Bitmap.BeginUpdate(True); 645 for X := 0 to Size.X- 1 do646 for Y := 0 to Size.Y- 1 do647 Bitmap.Canvas.Pixels[X, Y] := SwapBRComponent(Pixels[X, Y]);652 for Y := 0 to Size.Y - 1 do 653 for X := 0 to Size.X - 1 do 654 Bitmap.Canvas.Pixels[X, Y] := TColor(SwapBRComponent(Pixels[X, Y])); 648 655 finally 649 656 Bitmap.EndUpdate(False); … … 664 671 begin 665 672 with FastBitmap do begin 666 for X := 0 to Size.X- 1 do667 for Y := 0 to Size.Y- 1 do668 Bitmap.Canvas.Pixels[X, Y] := SwapBRComponent(Pixels[X, Y]);673 for Y := 0 to Size.Y - 1 do 674 for X := 0 to Size.X - 1 do 675 Bitmap.Canvas.Pixels[X, Y] := TColor(SwapBRComponent(Pixels[X, Y])); 669 676 end; 670 677 end;
Note:
See TracChangeset
for help on using the changeset viewer.