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/bgrapolygon.pas

    r494 r521  
    5656        color: TExpandedPixel;
    5757        bounds: TRect;
    58       end;
    59     procedure AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel);
     58        fillMode: TFillMode;
     59        fillModeOverride: boolean;
     60      end;
     61    function AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel): integer; overload;
    6062    function CheckRectangleBorderBounds(var x1, y1, x2, y2: single; w: single): boolean;
    6163    procedure InternalAddStroke(const APoints: array of TPointF; AClosed: boolean; AData: Pointer);
     
    6769    constructor Create;
    6870    destructor Destroy; override;
    69     procedure AddShape(AShape: TBGRACustomFillInfo; AColor: TBGRAPixel);
    70     procedure AddShape(AShape: TBGRACustomFillInfo; ATexture: IBGRAScanner);
    71     procedure AddPolygon(const points: array of TPointF; AColor: TBGRAPixel);
    72     procedure AddPolygon(const points: array of TPointF; ATexture: IBGRAScanner);
    73     procedure AddPathStroke(APath: TBGRAPath; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker);
    74     procedure AddPathStroke(APath: TBGRAPath; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker);
    75     procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker);
    76     procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker);
    77     procedure AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel);
    78     procedure AddPathFill(APath: TBGRAPath; ATexture: IBGRAScanner);
    79     procedure AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel);
    80     procedure AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner);
    81     procedure AddPolylineStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker);
    82     procedure AddPolylineStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker);
    83     procedure AddPolygonStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker);
    84     procedure AddPolygonStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker);
    85     procedure AddTriangleLinearColor(pt1, pt2, pt3: TPointF; c1, c2, c3: TBGRAPixel);
    86     procedure AddTriangleLinearMapping(pt1, pt2, pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF);
     71    function AddShape(AShape: TBGRACustomFillInfo; AColor: TBGRAPixel): integer; overload;
     72    function AddShape(AShape: TBGRACustomFillInfo; ATexture: IBGRAScanner): integer; overload;
     73    function AddPolygon(const points: array of TPointF; AColor: TBGRAPixel): integer; overload;
     74    function AddPolygon(const points: array of TPointF; ATexture: IBGRAScanner): integer; overload;
     75    procedure AddPathStroke(APath: TBGRAPath; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker); overload;
     76    procedure AddPathStroke(APath: TBGRAPath; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker); overload;
     77    procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker); overload;
     78    procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker); overload;
     79    function AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel): integer; overload;
     80    function AddPathFill(APath: TBGRAPath; ATexture: IBGRAScanner): integer; overload;
     81    function AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel): integer; overload;
     82    function AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner): integer; overload;
     83    function AddPolylineStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload;
     84    function AddPolylineStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload;
     85    function AddPolygonStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload;
     86    function AddPolygonStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload;
     87    function AddTriangleLinearColor(pt1, pt2, pt3: TPointF; c1, c2, c3: TBGRAPixel): integer;
     88    function AddTriangleLinearMapping(pt1, pt2, pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF): integer;
    8789    procedure AddQuadLinearColor(pt1, pt2, pt3, pt4: TPointF; c1, c2, c3, c4: TBGRAPixel);
    8890    procedure AddQuadLinearMapping(pt1, pt2, pt3, pt4: TPointF; texture: IBGRAScanner; tex1, tex2, {%H-}tex3, tex4: TPointF;
    8991       ACulling: TFaceCulling = fcNone);
    9092    procedure AddQuadPerspectiveMapping(pt1, pt2, pt3, pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF);
    91     procedure AddEllipse(x, y, rx, ry: single; AColor: TBGRAPixel);
    92     procedure AddEllipse(x, y, rx, ry: single; ATexture: IBGRAScanner);
    93     procedure AddEllipseBorder(x, y, rx, ry, w: single; AColor: TBGRAPixel);
    94     procedure AddEllipseBorder(x, y, rx, ry, w: single; ATexture: IBGRAScanner);
    95     procedure AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []);
    96     procedure AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []);
    97     procedure AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []);
    98     procedure AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []);
    99     procedure AddRectangle(x1, y1, x2, y2: single; AColor: TBGRAPixel);
    100     procedure AddRectangle(x1, y1, x2, y2: single; ATexture: IBGRAScanner);
    101     procedure AddRectangleBorder(x1, y1, x2, y2, w: single; AColor: TBGRAPixel);
    102     procedure AddRectangleBorder(x1, y1, x2, y2, w: single; ATexture: IBGRAScanner);
     93    function AddEllipse(x, y, rx, ry: single; AColor: TBGRAPixel): integer; overload;
     94    function AddEllipse(x, y, rx, ry: single; ATexture: IBGRAScanner): integer; overload;
     95    function AddEllipseBorder(x, y, rx, ry, w: single; AColor: TBGRAPixel): integer; overload;
     96    function AddEllipseBorder(x, y, rx, ry, w: single; ATexture: IBGRAScanner): integer; overload;
     97    function AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []): integer; overload;
     98    function AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []): integer; overload;
     99    function AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []): integer; overload;
     100    function AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []): integer; overload;
     101    function AddRectangle(x1, y1, x2, y2: single; AColor: TBGRAPixel): integer; overload;
     102    function AddRectangle(x1, y1, x2, y2: single; ATexture: IBGRAScanner): integer; overload;
     103    function AddRectangleBorder(x1, y1, x2, y2, w: single; AColor: TBGRAPixel): integer; overload;
     104    function AddRectangleBorder(x1, y1, x2, y2, w: single; ATexture: IBGRAScanner): integer; overload;
     105    procedure OverrideFillMode(AShapeIndex: integer; AFillMode: TFillMode);
    103106    procedure Draw(dest: TBGRACustomBitmap; ADrawMode: TDrawMode = dmDrawWithTransparency);
     107    property ShapeCount: integer read nbShapes;
    104108  end;
    105109
    106110procedure FillPolyAliased(bmp: TBGRACustomBitmap; points: array of TPointF;
    107   c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode);
     111  c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean = true);
    108112procedure FillPolyAliasedWithTexture(bmp: TBGRACustomBitmap; points: array of TPointF;
    109   scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode);
     113  scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean = true);
    110114procedure FillPolyAntialias(bmp: TBGRACustomBitmap; points: array of TPointF;
    111   c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean = false);
     115  c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true);
    112116procedure FillPolyAntialiasWithTexture(bmp: TBGRACustomBitmap; points: array of TPointF;
    113   scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean = false);
     117  scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true);
    114118
    115119procedure FillEllipseAntialias(bmp: TBGRACustomBitmap; x, y, rx, ry: single;
     
    123127  scan: IBGRAScanner; LinearBlend: boolean = false);
    124128
     129procedure BorderEllipse(bmp: TBGRACustomBitmap; x, y, rx, ry, w: single;
     130  c: TBGRAPixel; EraseMode: boolean; drawmode: TDrawMode);
     131procedure BorderEllipseWithTexture(bmp: TBGRACustomBitmap; x, y, rx, ry, w: single;
     132  scan: IBGRAScanner; drawmode: TDrawMode);
     133
    125134procedure FillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry: single;
    126   options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false);
     135  options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true);
    127136procedure FillRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry: single;
    128   options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false);
     137  options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true);
    129138
    130139procedure BorderRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry, w: single;
    131   options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false);
     140  options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true);
    132141procedure BorderRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry, w: single;
    133   options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false);
     142  options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true);
    134143
    135144procedure BorderAndFillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry, w: single;
    136   options: TRoundRectangleOptions; bordercolor,fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean);
     145  options: TRoundRectangleOptions; bordercolor,fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean; APixelCenteredCoordinates: boolean = true);
    137146
    138147implementation
     
    163172  miny, maxy, minx, maxx,
    164173  densMinX, densMaxX: integer;
     174  joinDensity, nextJoinDensity: boolean;
    165175
    166176  density: PDensity;
     
    312322      if optimised then
    313323      begin
     324        nextJoinDensity := false;
    314325        for i := 0 to firstScan.nbinter div 2 - 1 do
    315326        begin
     327          joinDensity := nextJoinDensity;
    316328          x1 := firstScan.inter[i+i].interX;
    317329          x1b := lastScan.inter[i+i].interX;
    318330          x2 := firstScan.inter[i+i+1].interX;
    319331          x2b := lastScan.inter[i+i+1].interX;
     332          nextJoinDensity := not ((i+i+2 >= firstScan.nbInter) or
     333              ((firstScan.inter[i+i+2].interX >= x2+1) and
     334               (lastScan.inter[i+i+2].interX >= x2b+1)));
    320335          if (abs(x1-x1b)<oneOver512) and (abs(x2-x2b)<oneOver512) and
    321              ((i+i+2 >= firstScan.nbInter) or
    322               ((firstScan.inter[i+i+2].interX >= x2+1) and
    323                (lastScan.inter[i+i+2].interX >= x2b+1))) then
     336              not joinDensity and not nextJoinDensity then
    324337          begin
    325338            x1 := (x1+x1b)*0.5;
    326339            x2 := (x2+x2b)*0.5;
     340
     341            if x1 < minx then x1 := minx;
    327342            ix1 := floor(x1);
    328             ix2 := floor(x2);
    329             if ix1 < minx then ix1 := minx;
     343
     344            if x2 >= maxx+1 then
     345            begin
     346              x2 := maxx+1;
     347              ix2 := maxx;
     348            end else
     349              ix2 := floor(x2);
    330350            if ix2 > maxx then ix2 := maxx;
     351
    331352            if ix1>ix2 then continue;
    332353            if ix1=ix2 then
     
    600621
    601622procedure FillPolyAliased(bmp: TBGRACustomBitmap; points: array of TPointF;
    602   c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode);
     623  c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean);
    603624var
    604625  info: TCustomFillPolyInfo;
     
    607628    exit;
    608629
    609   info := TOnePassFillPolyInfo.Create(points);
     630  info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates);
    610631  FillShapeAliased(bmp, info, c, EraseMode, nil, NonZeroWinding, drawmode);
    611632  info.Free;
     
    613634
    614635procedure FillPolyAliasedWithTexture(bmp: TBGRACustomBitmap;
    615   points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode);
     636  points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean);
    616637var
    617638  info: TCustomFillPolyInfo;
     
    620641    exit;
    621642
    622   info := TOnePassFillPolyInfo.Create(points);
     643  info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates);
    623644  FillShapeAliased(bmp, info, BGRAPixelTransparent,False,scan, NonZeroWinding, drawmode);
    624645  info.Free;
     
    626647
    627648procedure FillPolyAntialias(bmp: TBGRACustomBitmap; points: array of TPointF;
    628   c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean);
     649  c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean);
    629650var
    630651  info: TCustomFillPolyInfo;
     
    633654    exit;
    634655
    635   info := TOnePassFillPolyInfo.Create(points);
     656  info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates);
    636657  FillShapeAntialias(bmp, info, c, EraseMode, nil, NonZeroWinding, LinearBlend);
    637658  info.Free;
     
    639660
    640661procedure FillPolyAntialiasWithTexture(bmp: TBGRACustomBitmap;
    641   points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean);
     662  points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean);
    642663var
    643664  info: TCustomFillPolyInfo;
     
    646667    exit;
    647668
    648   info := TOnePassFillPolyInfo.Create(points);
     669  info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates);
    649670  FillShapeAntialiasWithTexture(bmp, info, scan, NonZeroWinding, LinearBlend);
    650671  info.Free;
     
    703724{ TBGRAMultishapeFiller }
    704725
    705 procedure TBGRAMultishapeFiller.AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel);
     726function TBGRAMultishapeFiller.AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel): integer;
    706727begin
    707728  if length(shapes) = nbShapes then
    708729    setlength(shapes, (length(shapes)+1)*2);
    709   with shapes[nbShapes] do
     730  result := nbShapes;
     731  inc(nbShapes);
     732
     733  with shapes[result] do
    710734  begin
    711735    info := AInfo;
     
    714738    internalTexture:= AInternalTexture;
    715739    color := GammaExpansion(AColor);
    716   end;
    717   inc(nbShapes);
     740    fillModeOverride:= false;
     741  end;
    718742end;
    719743
     
    740764  const APoints: array of TPointF; AClosed: boolean; AData: Pointer);
    741765var pts: ArrayOfTPointF;
     766  idxShape: Integer;
    742767begin
    743768  with TPathStrokeData(AData^) do
     
    748773      pts := Stroker.ComputePolylineAutoCycle(APoints, Width);
    749774    if Texture <> nil then
    750       AddPolygon(pts, Texture)
     775      idxShape := AddPolygon(pts, Texture)
    751776    else
    752       AddPolygon(pts, Color);
     777      idxShape := AddPolygon(pts, Color);
     778    OverrideFillMode(idxShape, fmWinding);
    753779  end;
    754780end;
     
    777803end;
    778804
    779 procedure TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo; AColor: TBGRAPixel);
    780 begin
    781   AddShape(AShape,False,nil,nil,AColor);
    782 end;
    783 
    784 procedure TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo;
    785   ATexture: IBGRAScanner);
    786 begin
    787   AddShape(AShape,False,ATexture,nil,BGRAPixelTransparent);
    788 end;
    789 
    790 procedure TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF;
    791   AColor: TBGRAPixel);
    792 begin
    793   if length(points) <= 2 then exit;
    794   AddShape(TOnePassFillPolyInfo.Create(points),True,nil,nil,AColor);
    795 end;
    796 
    797 procedure TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF;
    798   ATexture: IBGRAScanner);
    799 begin
    800   if length(points) <= 2 then exit;
    801   AddShape(TOnePassFillPolyInfo.Create(points),True,ATexture,nil,BGRAPixelTransparent);
     805function TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo;
     806  AColor: TBGRAPixel): integer;
     807begin
     808  result := AddShape(AShape,False,nil,nil,AColor);
     809end;
     810
     811function TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo;
     812  ATexture: IBGRAScanner): integer;
     813begin
     814  result := AddShape(AShape,False,ATexture,nil,BGRAPixelTransparent);
     815end;
     816
     817function TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF;
     818  AColor: TBGRAPixel): integer;
     819begin
     820  if length(points) <= 2 then exit(-1);
     821  result := AddShape(TOnePassFillPolyInfo.Create(points),True,nil,nil,AColor);
     822end;
     823
     824function TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF;
     825  ATexture: IBGRAScanner): integer;
     826begin
     827  if length(points) <= 2 then exit(-1);
     828  result := AddShape(TOnePassFillPolyInfo.Create(points),True,ATexture,nil,BGRAPixelTransparent);
    802829end;
    803830
     
    838865end;
    839866
    840 procedure TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel);
    841 begin
    842   AddPolygon(APath.ToPoints, AColor);
    843 end;
    844 
    845 procedure TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;
    846   ATexture: IBGRAScanner);
    847 begin
    848   AddPolygon(APath.ToPoints, ATexture);
    849 end;
    850 
    851 procedure TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;
    852   AMatrix: TAffineMatrix; AColor: TBGRAPixel);
    853 begin
    854   AddPolygon(APath.ToPoints(AMatrix), AColor);
    855 end;
    856 
    857 procedure TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;
    858   AMatrix: TAffineMatrix; ATexture: IBGRAScanner);
    859 begin
    860   AddPolygon(APath.ToPoints(AMatrix), ATexture);
    861 end;
    862 
    863 procedure TBGRAMultishapeFiller.AddPolylineStroke(
     867function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel): integer;
     868begin
     869  result := AddPolygon(APath.ToPoints, AColor);
     870end;
     871
     872function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;
     873  ATexture: IBGRAScanner): integer;
     874begin
     875  result := AddPolygon(APath.ToPoints, ATexture);
     876end;
     877
     878function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;
     879  AMatrix: TAffineMatrix; AColor: TBGRAPixel): integer;
     880begin
     881  result := AddPolygon(APath.ToPoints(AMatrix), AColor);
     882end;
     883
     884function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;
     885  AMatrix: TAffineMatrix; ATexture: IBGRAScanner): integer;
     886begin
     887  result := AddPolygon(APath.ToPoints(AMatrix), ATexture);
     888end;
     889
     890function TBGRAMultishapeFiller.AddPolylineStroke(
    864891  const points: array of TPointF; AColor: TBGRAPixel; AWidth: single;
    865   AStroker: TBGRACustomPenStroker);
    866 begin
    867   AddPolygon(AStroker.ComputePolyline(points,AWidth,AColor), AColor);
    868 end;
    869 
    870 procedure TBGRAMultishapeFiller.AddPolylineStroke(
     892  AStroker: TBGRACustomPenStroker): integer;
     893begin
     894  result := AddPolygon(AStroker.ComputePolyline(points,AWidth,AColor), AColor);
     895end;
     896
     897function TBGRAMultishapeFiller.AddPolylineStroke(
    871898  const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single;
    872   AStroker: TBGRACustomPenStroker);
    873 begin
    874   AddPolygon(AStroker.ComputePolyline(points,AWidth), ATexture);
    875 end;
    876 
    877 procedure TBGRAMultishapeFiller.AddPolygonStroke(
    878   const points: array of TPointF; AColor: TBGRAPixel; AWidth: single;
    879   AStroker: TBGRACustomPenStroker);
    880 begin
    881   AddPolygon(AStroker.ComputePolygon(points,AWidth), AColor);
    882 end;
    883 
    884 procedure TBGRAMultishapeFiller.AddPolygonStroke(
    885   const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single;
    886   AStroker: TBGRACustomPenStroker);
    887 begin
    888   AddPolygon(AStroker.ComputePolygon(points,AWidth), ATexture);
    889 end;
    890 
    891 procedure TBGRAMultishapeFiller.AddTriangleLinearColor(pt1, pt2, pt3: TPointF; c1, c2,
    892   c3: TBGRAPixel);
     899  AStroker: TBGRACustomPenStroker): integer;
     900begin
     901  result := AddPolygon(AStroker.ComputePolyline(points,AWidth), ATexture);
     902end;
     903
     904function TBGRAMultishapeFiller.AddPolygonStroke(const points: array of TPointF;
     905  AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker): integer;
     906begin
     907  result := AddPolygon(AStroker.ComputePolygon(points,AWidth), AColor);
     908end;
     909
     910function TBGRAMultishapeFiller.AddPolygonStroke(const points: array of TPointF;
     911  ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker
     912  ): integer;
     913begin
     914  result := AddPolygon(AStroker.ComputePolygon(points,AWidth), ATexture);
     915end;
     916
     917function TBGRAMultishapeFiller.AddTriangleLinearColor(pt1, pt2, pt3: TPointF;
     918  c1, c2, c3: TBGRAPixel): integer;
    893919var grad: TBGRAGradientTriangleScanner;
    894920begin
    895921  if (c1 = c2) and (c2 = c3) then
    896     AddPolygon([pt1,pt2,pt3],c1)
     922    result := AddPolygon([pt1,pt2,pt3],c1)
    897923  else
    898924  begin
    899925    grad := TBGRAGradientTriangleScanner.Create(pt1,pt2,pt3, c1,c2,c3);
    900     AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,grad,grad,BGRAPixelTransparent);
    901   end;
    902 end;
    903 
    904 procedure TBGRAMultishapeFiller.AddTriangleLinearMapping(pt1, pt2,
    905   pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF);
     926    result := AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,grad,grad,BGRAPixelTransparent);
     927  end;
     928end;
     929
     930function TBGRAMultishapeFiller.AddTriangleLinearMapping(pt1, pt2, pt3: TPointF;
     931  texture: IBGRAScanner; tex1, tex2, tex3: TPointF): integer;
    906932var
    907933  mapping: TBGRATriangleLinearMapping;
    908934begin
    909935  mapping := TBGRATriangleLinearMapping.Create(texture, pt1,pt2,pt3, tex1, tex2, tex3);
    910   AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,mapping,mapping,BGRAPixelTransparent);
     936  result := AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,mapping,mapping,BGRAPixelTransparent);
    911937end;
    912938
     
    952978end;
    953979
    954 procedure TBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single; AColor: TBGRAPixel
    955   );
    956 begin
    957   AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,nil,nil,AColor);
    958 end;
    959 
    960 procedure TBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single;
    961   ATexture: IBGRAScanner);
    962 begin
    963   AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,ATexture,nil,BGRAPixelTransparent);
    964 end;
    965 
    966 procedure TBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single;
    967   AColor: TBGRAPixel);
    968 begin
    969   AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,nil,nil,AColor);
    970 end;
    971 
    972 procedure TBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single;
    973   ATexture: IBGRAScanner);
    974 begin
    975   AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,ATexture,nil,BGRAPixelTransparent);
    976 end;
    977 
    978 procedure TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx, ry: single;
    979   AColor: TBGRAPixel; options: TRoundRectangleOptions);
    980 begin
    981   AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True,nil,nil,AColor);
    982 end;
    983 
    984 procedure TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx, ry: single;
    985   ATexture: IBGRAScanner; options: TRoundRectangleOptions);
    986 begin
    987   AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True,
     980function TBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single;
     981  AColor: TBGRAPixel): integer;
     982begin
     983  result := AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,nil,nil,AColor);
     984end;
     985
     986function TBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single;
     987  ATexture: IBGRAScanner): integer;
     988begin
     989  result := AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,ATexture,nil,BGRAPixelTransparent);
     990end;
     991
     992function TBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single;
     993  AColor: TBGRAPixel): integer;
     994begin
     995  result := AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,nil,nil,AColor);
     996end;
     997
     998function TBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single;
     999  ATexture: IBGRAScanner): integer;
     1000begin
     1001  result := AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,ATexture,nil,BGRAPixelTransparent);
     1002end;
     1003
     1004function TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx,
     1005  ry: single; AColor: TBGRAPixel; options: TRoundRectangleOptions): integer;
     1006begin
     1007  result := AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True,nil,nil,AColor);
     1008end;
     1009
     1010function TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx,
     1011  ry: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions): integer;
     1012begin
     1013  result := AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True,
    9881014     ATexture,nil,BGRAPixelTransparent);
    9891015end;
    9901016
    991 procedure TBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx,
    992   ry, w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions);
    993 begin
    994   AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True,
     1017function TBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry,
     1018  w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions): integer;
     1019begin
     1020  result := AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True,
    9951021    nil,nil,AColor);
    9961022end;
    9971023
    998 procedure TBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry,
    999   w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions);
    1000 begin
    1001   AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True,
     1024function TBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry,
     1025  w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions): integer;
     1026begin
     1027  result := AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True,
    10021028    ATexture,nil,BGRAPixelTransparent);
    10031029end;
    10041030
    1005 procedure TBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single;
    1006   AColor: TBGRAPixel);
    1007 begin
    1008   AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],AColor);
    1009 end;
    1010 
    1011 procedure TBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single;
    1012   ATexture: IBGRAScanner);
    1013 begin
    1014   AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],ATexture);
    1015 end;
    1016 
    1017 procedure TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2,
    1018   w: single; AColor: TBGRAPixel);
     1031function TBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single;
     1032  AColor: TBGRAPixel): integer;
     1033begin
     1034  result := AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],AColor);
     1035end;
     1036
     1037function TBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single;
     1038  ATexture: IBGRAScanner): integer;
     1039begin
     1040  result := AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],ATexture);
     1041end;
     1042
     1043function TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2, w: single;
     1044  AColor: TBGRAPixel): integer;
    10191045var hw : single;
    10201046begin
    10211047  hw := w/2;
    10221048  if not CheckRectangleBorderBounds(x1,y1,x2,y2,w) then
    1023     AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,AColor) else
    1024     AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF,
     1049    result := AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,AColor) else
     1050    result := AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF,
    10251051                PointF(x1+hw,y2-hw),PointF(x2-hw,y2-hw),PointF(x2-hw,y1+hw),PointF(x1+hw,y1+hw)],AColor);
    10261052end;
    10271053
    1028 procedure TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2,
    1029   w: single; ATexture: IBGRAScanner);
     1054function TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2, w: single;
     1055  ATexture: IBGRAScanner): integer;
    10301056var hw : single;
    10311057begin
    10321058  hw := w/2;
    10331059  if not CheckRectangleBorderBounds(x1,y1,x2,y2,w) then
    1034     AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,ATexture) else
    1035     AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF,
     1060    result := AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,ATexture) else
     1061    result := AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF,
    10361062                PointF(x1+hw,y2-hw),PointF(x2-hw,y2-hw),PointF(x2-hw,y1+hw),PointF(x1+hw,y1+hw)],ATexture);
     1063end;
     1064
     1065procedure TBGRAMultishapeFiller.OverrideFillMode(AShapeIndex: integer;
     1066  AFillMode: TFillMode);
     1067begin
     1068  if AShapeIndex < 0 then exit;
     1069  if AShapeIndex >= nbShapes then raise exception.Create('Index out of bounds');
     1070  shapes[AShapeIndex].fillMode := AFillMode;
     1071  shapes[AShapeIndex].fillModeOverride := true;
    10371072end;
    10381073
     
    11161151      begin
    11171152        //find intersections
    1118         info.ComputeAndSort(cury, inter, nbInter, FillMode=fmWinding);
     1153        info.ComputeAndSort(cury, inter, nbInter, fillMode=fmWinding);
    11191154        nbInter := nbInter and not 1; //even
    11201155      end;
     
    11501185            if ix2 > densMaxx then densMaxx := ix2;
    11511186
    1152             FillWord(density[ix1-minx],ix2-ix1+1,256);
     1187            if ix2 >= ix1 then
     1188              FillWord(density[ix1-minx],ix2-ix1+1,256);
    11531189          end;
    11541190        end else
    1155                   {$DEFINE INCLUDE_FILLDENSITY}
     1191          {$DEFINE INCLUDE_FILLDENSITY}
    11561192          {$i density256.inc}
    11571193      end;
     
    11741210  bounds: TRect;
    11751211
    1176   xb, yb, yc, j,k: integer;
     1212  xb, yb, yc, k: integer;
    11771213  pdest:    PBGRAPixel;
    11781214
    11791215  curSum,nextSum: ^TCardinalSum;
    11801216  sums: array of TCardinalSum;
     1217  curAlpha: byte;
    11811218
    11821219  pdens: PDensity;
    1183   w: cardinal;
     1220  w: UInt32or64;
    11841221  ec: TExpandedPixel;
    11851222  count: integer;
     
    11881225begin
    11891226  if nbShapes = 0 then exit;
     1227  for k := 0 to nbShapes-1 do
     1228    if not shapes[k].fillModeOverride then shapes[k].fillMode:= fillMode;
     1229
    11901230  useAA := Antialiasing and (ADrawMode in [dmDrawWithTransparency,dmLinearBlend]);
    11911231  if nbShapes = 1 then
    11921232  begin
    11931233    if useAA then
    1194       FillShapeAntialias(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture,FillMode = fmWinding, ADrawMode=dmLinearBlend) else
    1195       FillShapeAliased(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture,FillMode = fmWinding, ADrawMode,
     1234      FillShapeAntialias(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture,shapes[0].fillMode = fmWinding, ADrawMode=dmLinearBlend) else
     1235      FillShapeAliased(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture,shapes[0].fillMode = fmWinding, ADrawMode,
    11961236        AliasingIncludeBottomRight);
    11971237    exit;
     
    12351275    AliasingOfs := PointF(-0.0001,-0.0001);
    12361276
    1237   setlength(sums,maxx-minx+2); //more for safety
     1277  setlength(sums,maxx-minx+1);
    12381278  setlength(shapeRowsList, nbShapes);
    12391279
     
    12671307    end;
    12681308
    1269     rowminx := minx;
    1270     rowmaxx := maxx;
     1309    if rowminx < minx then rowminx := minx;
     1310    if rowmaxx > maxx then rowmaxx := maxx;
     1311
    12711312    if rowminx <= rowmaxx then
    12721313    begin
    1273       if rowminx < minx then rowminx := minx;
    1274       if rowmaxx > maxx then rowmaxx := maxx;
    1275 
    12761314      FillChar(sums[rowminx-minx],(rowmaxx-rowminx+1)*sizeof(sums[0]),0);
    12771315
     
    12981336                ec.green := (sumG+sumA shr 1) div sumA;
    12991337                ec.blue := (sumB+sumA shr 1) div sumA;
    1300                 if sumA > 255 then sumA := 255;
    1301                 ec.alpha := sumA shl 8 + sumA;
     1338                if sumA > 255 then curAlpha := 255 else curAlpha := sumA;
     1339                ec.alpha := curAlpha shl 8 + curAlpha;
    13021340                count := 1;
    13031341                while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB)
     
    13091347                end;
    13101348                if count = 1 then
    1311                   DrawExpandedPixelInlineNoAlphaCheck(pdest,ec,sumA) else
     1349                  DrawExpandedPixelInlineNoAlphaCheck(pdest,ec,curAlpha) else
    13121350                   DrawExpandedPixelsInline(pdest, ec, count );
    13131351                inc(pdest,count-1);
     
    13301368                ec.green := (sumG+sumA shr 1) div sumA;
    13311369                ec.blue := (sumB+sumA shr 1) div sumA;
    1332                 if sumA > 255 then sumA := 255;
    1333                 ec.alpha := sumA shl 8 + sumA;
     1370                if sumA > 255 then curAlpha := 255 else curAlpha := sumA;
     1371                ec.alpha := curAlpha shl 8 + curAlpha;
    13341372                count := 1;
    13351373                while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB)
     
    13421380                if count = 1 then
    13431381                  DrawPixelInlineNoAlphaCheck(pdest,GammaCompression(ec)) else
     1382                begin
    13441383                   DrawPixelsInline(pdest, GammaCompression(ec), count );
    1345                 inc(pdest,count-1);
     1384                   inc(pdest,count-1);
     1385                end;
    13461386              end;
    13471387            end;
     
    13621402                ec.green := (sumG+sumA shr 1) div sumA;
    13631403                ec.blue := (sumB+sumA shr 1) div sumA;
    1364                 if sumA > 255 then sumA := 255;
    1365                 ec.alpha := sumA shl 8 + sumA;
     1404                if sumA > 255 then curAlpha := 255 else curAlpha := sumA;
     1405                ec.alpha := curAlpha shl 8 + curAlpha;
    13661406                count := 1;
    13671407                while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB)
     
    13921432                ec.green := (sumG+sumA shr 1) div sumA;
    13931433                ec.blue := (sumB+sumA shr 1) div sumA;
    1394                 if sumA > 255 then sumA := 255;
    1395                 ec.alpha := sumA shl 8 + sumA;
     1434                if sumA > 255 then curAlpha := 255 else curAlpha := sumA;
     1435                ec.alpha := curAlpha shl 8 + curAlpha;
    13961436                count := 1;
    13971437                while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB)
     
    14221462                ec.green := (sumG+sumA shr 1) div sumA;
    14231463                ec.blue := (sumB+sumA shr 1) div sumA;
    1424                 if sumA > 255 then sumA := 255;
    1425                 ec.alpha := sumA shl 8 + sumA;
     1464                if sumA > 255 then curAlpha := 255 else curAlpha := sumA;
     1465                ec.alpha := curAlpha shl 8 + curAlpha;
    14261466                count := 1;
    14271467                while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB)
     
    14541494end;
    14551495
     1496procedure BorderEllipse(bmp: TBGRACustomBitmap; x, y, rx, ry, w: single;
     1497  c: TBGRAPixel; EraseMode: boolean; drawmode: TDrawMode);
     1498var
     1499  info: TFillBorderEllipseInfo;
     1500begin
     1501  if ((rx = 0) and (ry = 0)) or (w=0) or (x = EmptySingle) or (y = EmptySingle) then
     1502    exit;
     1503  info := TFillBorderEllipseInfo.Create(x, y, rx, ry, w);
     1504  FillShapeAliased(bmp, info, c, EraseMode, nil, False, drawmode);
     1505  info.Free;
     1506end;
     1507
     1508procedure BorderEllipseWithTexture(bmp: TBGRACustomBitmap; x, y, rx, ry,
     1509  w: single; scan: IBGRAScanner; drawmode: TDrawMode);
     1510var
     1511  info: TFillBorderEllipseInfo;
     1512begin
     1513  if ((rx = 0) and (ry = 0)) or (w=0) or (x = EmptySingle) or (y = EmptySingle) then
     1514    exit;
     1515  info := TFillBorderEllipseInfo.Create(x, y, rx, ry, w);
     1516  FillShapeAliased(bmp, info, BGRAPixelTransparent, False, scan, false, drawmode);
     1517  info.Free;
     1518end;
     1519
    14561520procedure FillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2,
    1457   rx, ry: single; options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean);
     1521  rx, ry: single; options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean);
    14581522var
    14591523  info: TFillRoundRectangleInfo;
    14601524begin
    14611525  if (x1 = x2) or (y1 = y2) then exit;
    1462   info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options);
     1526  info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options, APixelCenteredCoordinates);
    14631527  FillShapeAntialias(bmp, info, c, EraseMode,nil, False, LinearBlend);
    14641528  info.Free;
     
    14671531procedure FillRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1,
    14681532  y1, x2, y2, rx, ry: single; options: TRoundRectangleOptions;
    1469   scan: IBGRAScanner; LinearBlend: boolean);
     1533  scan: IBGRAScanner; LinearBlend: boolean; APixelCenteredCoordinates: boolean);
    14701534var
    14711535  info: TFillRoundRectangleInfo;
    14721536begin
    14731537  if (x1 = x2) or (y1 = y2) then exit;
    1474   info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options);
     1538  info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options, APixelCenteredCoordinates);
    14751539  FillShapeAntialiasWithTexture(bmp, info, scan, False, LinearBlend);
    14761540  info.Free;
     
    14791543procedure BorderRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2,
    14801544  y2, rx, ry, w: single; options: TRoundRectangleOptions; c: TBGRAPixel;
    1481   EraseMode: boolean; LinearBlend: boolean);
     1545  EraseMode: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean);
    14821546var
    14831547  info: TFillShapeInfo;
     
    14931557    exit;
    14941558  end;
    1495   info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options);
     1559  info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options, APixelCenteredCoordinates);
    14961560  FillShapeAntialias(bmp, info, c, EraseMode, nil, False, LinearBlend);
    14971561  info.Free;
     
    15001564procedure BorderRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1,
    15011565  y1, x2, y2, rx, ry, w: single; options: TRoundRectangleOptions;
    1502   scan: IBGRAScanner; LinearBlend: boolean);
     1566  scan: IBGRAScanner; LinearBlend: boolean; APixelCenteredCoordinates: boolean);
    15031567var
    15041568  info: TFillBorderRoundRectInfo;
     
    15141578    exit;
    15151579  end;
    1516   info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options);
     1580  info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options, APixelCenteredCoordinates);
    15171581  FillShapeAntialiasWithTexture(bmp, info, scan, False, LinearBlend);
    15181582  info.Free;
     
    15211585procedure BorderAndFillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1,
    15221586  x2, y2, rx, ry, w: single; options: TRoundRectangleOptions; bordercolor,
    1523   fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean);
     1587  fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean; APixelCenteredCoordinates: boolean);
    15241588var
    15251589  info: TFillBorderRoundRectInfo;
     
    15271591begin
    15281592  if (rx = 0) or (ry = 0) then exit;
    1529   info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options);
     1593  info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options, APixelCenteredCoordinates);
    15301594  if not EraseMode then
    15311595  begin
Note: See TracChangeset for help on using the changeset viewer.