Ignore:
Timestamp:
Apr 17, 2019, 12:58:41 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Propagate project build mode options to used packages.
  • Added: Check memory leaks using heaptrc.
  • Modified: Update BGRABitmap package.
Location:
GraphicTest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest

    • Property svn:ignore
      •  

        old new  
        88GraphicTest.lps
        99GraphicTest.dbg
         10heaptrclog.trc
  • GraphicTest/Packages/bgrabitmap/bgraopengltype.pas

    r494 r521  
    142142    procedure TextRect(ARect: TRectF; const Text : UTF8String; AHorizAlign: TAlignment; AVertAlign: TTextLayout; AColor: TBGRAPixel); overload;
    143143    function TextWidth(const Text: UTF8String): single; virtual; abstract;
    144     function TextHeight(const Text: UTF8String): single; virtual; abstract; overload;
    145     function TextHeight(const Text: UTF8String; AWidth: single): single; virtual; abstract; overload;
     144    function TextHeight(const Text: UTF8String): single; overload; virtual; abstract;
     145    function TextHeight(const Text: UTF8String; AWidth: single): single; overload; virtual; abstract;
    146146    procedure SetGradientColors(ATopLeft, ATopRight, ABottomRight, ABottomLeft: TBGRAPixel); virtual; abstract;
    147147
     
    184184    procedure ToggleFlipY;
    185185    procedure ToggleMask;
     186    function FilterBlurMotion(ARadius: single; ABlurType: TRadialBlurType; ADirection: TPointF): IBGLTexture;
     187    function FilterBlurRadial(ARadius: single; ABlurType: TRadialBlurType): IBGLTexture;
    186188    procedure SetFrame(AIndex: integer);
    187189    procedure FreeMemory;
     
    212214    procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AAlpha: byte = 255); overload;
    213215    procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AColor: TBGRAPixel); overload;
    214     procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF);
    215     procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    216     procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF);
    217     procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    218     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    219     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    220     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    221     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    222     procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF);
    223     procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    224     procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF);
    225     procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    226     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    227     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    228     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    229     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
     216    procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload;
     217    procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     218    procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload;
     219    procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     220    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     221    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     222    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     223    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     224    procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload;
     225    procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     226    procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload;
     227    procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     228    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     229    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     230    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     231    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
    230232
    231233    property Width: integer read GetWidth;
     
    266268    procedure NoClip; override;
    267269    destructor Destroy; override;
    268     procedure SwapRedBlue; override; overload;
     270    procedure SwapRedBlue; overload; override;
    269271    function Resample(newWidth, newHeight: integer; mode: TResampleMode=rmFineResample): TBGRACustomBitmap; override;
    270     procedure ApplyGlobalOpacity(alpha: byte); override; overload;
    271     procedure ReplaceColor(before, after: TColor); override; overload;
    272     procedure ReplaceColor(before, after: TBGRAPixel); override; overload;
    273     procedure ReplaceTransparent(after: TBGRAPixel); override; overload;
     272    procedure ApplyGlobalOpacity(alpha: byte); overload; override;
     273    procedure ReplaceColor(before, after: TColor); overload; override;
     274    procedure ReplaceColor(before, after: TBGRAPixel); overload; override;
     275    procedure ReplaceTransparent(after: TBGRAPixel); overload; override;
    274276    procedure SetClipRect(const AValue: TRect); override;
    275277    procedure SetSize(AWidth, AHeight: integer); override;
     
    363365    procedure ToggleFlipY; virtual; abstract;
    364366    procedure ToggleMask; virtual;
     367    function FilterBlurMotion({%H-}ARadius: single; {%H-}ABlurType: TRadialBlurType; {%H-}ADirection: TPointF): IBGLTexture; virtual;
     368    function FilterBlurRadial({%H-}ARadius: single; {%H-}ABlurType: TRadialBlurType): IBGLTexture; virtual;
    365369
    366370    procedure SetFrameSize(x,y: integer);
     
    395399    procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AAlpha: byte = 255); overload;
    396400    procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AColor: TBGRAPixel); overload;
    397     procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF);
    398     procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    399     procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF);
    400     procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    401     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    402     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    403     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    404     procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    405     procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF);
    406     procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    407     procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF);
    408     procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    409     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    410     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
    411     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF);
    412     procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF);
     401    procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload;
     402    procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     403    procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload;
     404    procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     405    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     406    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     407    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     408    procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     409    procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload;
     410    procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     411    procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload;
     412    procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     413    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     414    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
     415    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload;
     416    procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload;
    413417
    414418    property Width: integer read GetWidth;
     
    427431  end;
    428432
     433  { TBGLCustomFrameBuffer }
     434
     435  TBGLCustomFrameBuffer = class
     436  protected
     437    FCanvas: pointer;
     438    function GetTexture: IBGLTexture; virtual; abstract;
     439    function GetHandle: pointer; virtual; abstract;
     440    function GetMatrix: TAffineMatrix; virtual; abstract;
     441    function GetHeight: integer; virtual; abstract;
     442    function GetProjectionMatrix: TMatrix4D; virtual; abstract;
     443    function GetWidth: integer; virtual; abstract;
     444    procedure SetMatrix(AValue: TAffineMatrix); virtual; abstract;
     445    procedure SetProjectionMatrix(AValue: TMatrix4D); virtual; abstract;
     446
     447  public
     448    procedure UseOrthoProjection; overload; virtual;
     449    procedure UseOrthoProjection(AMinX,AMinY,AMaxX,AMaxY: single); overload; virtual;
     450    function MakeTextureAndFree: IBGLTexture; virtual;
     451
     452    procedure SetCanvas(ACanvas: Pointer); //for internal use
     453    property Matrix: TAffineMatrix read GetMatrix write SetMatrix;
     454    property ProjectionMatrix: TMatrix4D read GetProjectionMatrix write SetProjectionMatrix;
     455    property Width: integer read GetWidth;
     456    property Height: integer read GetHeight;
     457    property Handle: pointer read GetHandle;
     458    property Texture: IBGLTexture read GetTexture;
     459  end;
     460
    429461type
    430462  TBGLBitmapAny = class of TBGLCustomBitmap;
     
    441473
    442474uses BGRAFilterScanner;
     475
     476procedure TBGLCustomFrameBuffer.UseOrthoProjection;
     477begin
     478  ProjectionMatrix := OrthoProjectionToOpenGL(0,0,Width,Height);
     479end;
     480
     481procedure TBGLCustomFrameBuffer.UseOrthoProjection(AMinX, AMinY, AMaxX, AMaxY: single);
     482begin
     483  ProjectionMatrix := OrthoProjectionToOpenGL(AMinX,AMinY,AMaxX,AMaxY);
     484end;
     485
     486function TBGLCustomFrameBuffer.MakeTextureAndFree: IBGLTexture;
     487begin
     488  result := nil;
     489  raise exception.create('Not implemented');
     490end;
     491
     492procedure TBGLCustomFrameBuffer.SetCanvas(ACanvas: Pointer);
     493begin
     494  FCanvas := ACanvas;
     495end;
    443496
    444497function OrthoProjectionToOpenGL(AMinX, AMinY, AMaxX, AMaxY: Single): TMatrix4D;
     
    595648end;
    596649
     650function TBGLCustomTexture.FilterBlurMotion(ARadius: single; ABlurType: TRadialBlurType;
     651  ADirection: TPointF): IBGLTexture;
     652begin
     653  result := nil;
     654  raise exception.Create('Not implemented');
     655end;
     656
     657function TBGLCustomTexture.FilterBlurRadial(ARadius: single; ABlurType: TRadialBlurType): IBGLTexture;
     658begin
     659  result := nil;
     660  raise exception.Create('Not implemented');
     661end;
     662
    597663procedure TBGLCustomTexture.Update(ARGBAData: PDWord; AllocatedWidth,
    598664  AllocatedHeight, ActualWidth, ActualHeight: integer; RGBAOrder: boolean);
     
    757823    begin
    758824      if not TBGRAPixel_RGBAOrder and not SupportsBGRAOrder then SwapRedBlue;
     825      if LineOrder = riloBottomToTop then VerticalFlip;
    759826      InitFromData(PDWord(Data), Width,Height, Width,Height, TBGRAPixel_RGBAOrder or not SupportsBGRAOrder);
     827      if LineOrder = riloBottomToTop then VerticalFlip;
    760828      if not TBGRAPixel_RGBAOrder and not SupportsBGRAOrder then SwapRedBlue;
    761829    end;
     
    10041072  AAlpha: byte);
    10051073begin
     1074  {$PUSH}{$OPTIMIZATION OFF}
    10061075  DoDrawAffine(Origin,HAxis,VAxis, BGRA(255,255,255,AAlpha));
     1076  {$POP}
    10071077end;
    10081078
     
    10101080  AColor: TBGRAPixel);
    10111081begin
     1082  {$PUSH}{$OPTIMIZATION OFF}
    10121083  DoDrawAffine(Origin,HAxis,VAxis, AColor);
     1084  {$POP}
    10131085end;
    10141086
Note: See TracChangeset for help on using the changeset viewer.