mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:09:30 +02:00
* Fix warnings and hints
git-svn-id: trunk@43484 -
This commit is contained in:
parent
dd8afa3490
commit
6d78547260
@ -43,34 +43,25 @@ type
|
|||||||
|
|
||||||
TEllipseInfo = class
|
TEllipseInfo = class
|
||||||
private
|
private
|
||||||
fcx, fcy, frx,fry,
|
fcx, fcy, frx,fry : double;
|
||||||
fa1, fa2, frot : real;
|
|
||||||
fx1,fy1, fx2,fy2 : integer;
|
|
||||||
InfoList : TList;
|
InfoList : TList;
|
||||||
procedure FreeList;
|
procedure FreeList;
|
||||||
procedure ClearList;
|
procedure ClearList;
|
||||||
function FindXIndex (x:integer) : integer;
|
function FindXIndex (x:integer) : integer;
|
||||||
procedure PrepareCalculation (var np:integer; var delta:real);
|
procedure PrepareCalculation (out np:integer; out delta:real);
|
||||||
function NewInfoRec (anX:integer) : PEllipseInfoData;
|
function NewInfoRec (anX:integer) : PEllipseInfoData;
|
||||||
procedure CalculateCircular (const b:TRect; var x,y,rx,ry:real);
|
procedure CalculateCircular (const b:TRect; out x,y,rx,ry:real);
|
||||||
public
|
public
|
||||||
constructor create;
|
constructor create;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
function GetInfoForX (x:integer; var ytopmax,ytopmin,ybotmax,ybotmin:integer):boolean;
|
function GetInfoForX (x:integer; var ytopmax,ytopmin,ybotmax,ybotmin:integer):boolean;
|
||||||
function GetInfoForX (x:integer; var Info:PEllipseInfoData):boolean;
|
function GetInfoForX (x:integer; var Info:PEllipseInfoData):boolean;
|
||||||
procedure GatherEllipseInfo (const bounds:TRect);
|
procedure GatherEllipseInfo (const bounds:TRect);
|
||||||
procedure GatherArcInfo (const bounds:TRect; alpha1,alpha2:real);
|
property cx : double read fcx; // center point
|
||||||
property cx : real read fcx; // center point
|
property cy : double read fcy;
|
||||||
property cy : real read fcy;
|
property rhor : double read frx; // radius
|
||||||
property rhor : real read frx; // radius
|
property rver : double read fry;
|
||||||
property rver : real read fry;
|
|
||||||
{ only usable when created with GatherArcInfo }
|
{ only usable when created with GatherArcInfo }
|
||||||
property a1 : real read fa1; // angle 1 and point on ellipse
|
|
||||||
property x1 : integer read fx1;
|
|
||||||
property y1 : integer read fy1;
|
|
||||||
property a2 : real read fa2; // angle 2 and point on ellipse
|
|
||||||
property x2 : integer read fx2;
|
|
||||||
property y2 : integer read fy2;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -115,6 +106,7 @@ end;
|
|||||||
function TEllipseInfo.GetInfoForX (x:integer; var ytopmax,ytopmin,ybotmax,ybotmin:integer):boolean;
|
function TEllipseInfo.GetInfoForX (x:integer; var ytopmax,ytopmin,ybotmax,ybotmin:integer):boolean;
|
||||||
var r : PEllipseInfoData;
|
var r : PEllipseInfoData;
|
||||||
begin
|
begin
|
||||||
|
R:=Nil;
|
||||||
result := GetInfoForX (x, r);
|
result := GetInfoForX (x, r);
|
||||||
if assigned(r) then
|
if assigned(r) then
|
||||||
begin
|
begin
|
||||||
@ -142,7 +134,7 @@ begin
|
|||||||
Info := PEllipseInfoData(InfoList[r])
|
Info := PEllipseInfoData(InfoList[r])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEllipseInfo.PrepareCalculation (var np:integer; var delta:real);
|
procedure TEllipseInfo.PrepareCalculation (out np:integer; out delta:real);
|
||||||
begin
|
begin
|
||||||
np := round(1.5708 * sqrt(sqr(frx)+sqr(fry)) );
|
np := round(1.5708 * sqrt(sqr(frx)+sqr(fry)) );
|
||||||
// number of pixel in quarter circel to calculate without gaps in drawing
|
// number of pixel in quarter circel to calculate without gaps in drawing
|
||||||
@ -163,7 +155,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEllipseInfo.CalculateCircular (const b:TRect; var x,y,rx,ry:real);
|
procedure TEllipseInfo.CalculateCircular (const b:TRect; out x,y,rx,ry:real);
|
||||||
begin
|
begin
|
||||||
with b do
|
with b do
|
||||||
begin
|
begin
|
||||||
@ -294,25 +286,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEllipseInfo.GatherArcInfo (const bounds:TRect; alpha1,alpha2:real);
|
|
||||||
var stAngle,endAngle:real;
|
|
||||||
|
|
||||||
procedure CheckAngles;
|
|
||||||
begin
|
|
||||||
if a1 < a2 then
|
|
||||||
begin
|
|
||||||
stAngle := a1;
|
|
||||||
endAngle := a2;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
stAngle := a2;
|
|
||||||
endAngle := a1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ The drawing routines }
|
{ The drawing routines }
|
||||||
|
|
||||||
@ -403,6 +376,7 @@ begin
|
|||||||
infoIn := TEllipseInfo.Create;
|
infoIn := TEllipseInfo.Create;
|
||||||
infoOut := TEllipseInfo.Create;
|
infoOut := TEllipseInfo.Create;
|
||||||
dec (width);
|
dec (width);
|
||||||
|
id:=Nil;
|
||||||
try
|
try
|
||||||
infoOut.GatherEllipseInfo(bounds);
|
infoOut.GatherEllipseInfo(bounds);
|
||||||
with bounds do
|
with bounds do
|
||||||
@ -438,6 +412,7 @@ var info : TEllipseInfo;
|
|||||||
id : PEllipseInfoData;
|
id : PEllipseInfoData;
|
||||||
CountDown, CountUp, half : integer;
|
CountDown, CountUp, half : integer;
|
||||||
begin
|
begin
|
||||||
|
id:=Nil;
|
||||||
with canv.pen do
|
with canv.pen do
|
||||||
case mode of
|
case mode of
|
||||||
pmMask : MyPutPix := @PutPixelAnd;
|
pmMask : MyPutPix := @PutPixelAnd;
|
||||||
@ -499,7 +474,6 @@ end;
|
|||||||
procedure FillEllipseColor (Canv:TFPCustomCanvas; const Bounds:TRect; const c:TFPColor);
|
procedure FillEllipseColor (Canv:TFPCustomCanvas; const Bounds:TRect; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
try
|
try
|
||||||
@ -521,7 +495,6 @@ end;
|
|||||||
procedure FillEllipseHashHorizontal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashHorizontal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
try
|
try
|
||||||
@ -539,7 +512,6 @@ end;
|
|||||||
procedure FillEllipseHashVertical (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashVertical (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
try
|
try
|
||||||
@ -557,7 +529,6 @@ end;
|
|||||||
procedure FillEllipseHashDiagonal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashDiagonal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
w : integer;
|
w : integer;
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
@ -579,7 +550,6 @@ end;
|
|||||||
procedure FillEllipseHashBackDiagonal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashBackDiagonal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
w : integer;
|
w : integer;
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
@ -601,7 +571,6 @@ end;
|
|||||||
procedure FillEllipseHashDiagCross (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashDiagCross (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
wy,w1,w2 : integer;
|
wy,w1,w2 : integer;
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
@ -627,7 +596,6 @@ end;
|
|||||||
procedure FillEllipseHashCross (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashCross (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
try
|
try
|
||||||
@ -649,7 +617,6 @@ end;
|
|||||||
procedure FillEllipseImage (Canv:TFPCustomCanvas; const Bounds:TRect; const Image:TFPCustomImage);
|
procedure FillEllipseImage (Canv:TFPCustomCanvas; const Bounds:TRect; const Image:TFPCustomImage);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
w : integer;
|
w : integer;
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
@ -670,7 +637,6 @@ end;
|
|||||||
procedure FillEllipseImageRel (Canv:TFPCustomCanvas; const Bounds:TRect; const Image:TFPCustomImage);
|
procedure FillEllipseImageRel (Canv:TFPCustomCanvas; const Bounds:TRect; const Image:TFPCustomImage);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
|
||||||
xo,yo, xi,yi : integer;
|
xo,yo, xi,yi : integer;
|
||||||
begin
|
begin
|
||||||
info := TEllipseInfo.Create;
|
info := TEllipseInfo.Create;
|
||||||
|
@ -64,7 +64,6 @@ end;
|
|||||||
|
|
||||||
procedure TFPCustomCanvas.RemoveHelpers;
|
procedure TFPCustomCanvas.RemoveHelpers;
|
||||||
var r : integer;
|
var r : integer;
|
||||||
OldState : boolean;
|
|
||||||
begin
|
begin
|
||||||
for r := FHelpers.count-1 downto 0 do
|
for r := FHelpers.count-1 downto 0 do
|
||||||
with TFPCanvasHelper(FHelpers[r]) do
|
with TFPCanvasHelper(FHelpers[r]) do
|
||||||
@ -334,6 +333,7 @@ end;
|
|||||||
|
|
||||||
function TFPCustomCanvas.TextExtent(const Text: string): TSize;
|
function TFPCustomCanvas.TextExtent(const Text: string): TSize;
|
||||||
begin
|
begin
|
||||||
|
Result:=Default(TSize);
|
||||||
GetTextSize(Text, Result.cx, Result.cy);
|
GetTextSize(Text, Result.cx, Result.cy);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -381,6 +381,7 @@ end;
|
|||||||
|
|
||||||
function TFPCustomCanvas.TextExtent(const Text: unicodestring): TSize;
|
function TFPCustomCanvas.TextExtent(const Text: unicodestring): TSize;
|
||||||
begin
|
begin
|
||||||
|
Result:=Default(TSize);
|
||||||
GetTextSize(Text, Result.cx, Result.cy);
|
GetTextSize(Text, Result.cx, Result.cy);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -684,7 +685,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCustomCanvas.Rectangle (const Bounds:TRect);
|
procedure TFPCustomCanvas.Rectangle (const Bounds:TRect);
|
||||||
var np,nb,dp,db,pb : boolean;
|
var np,nb,dp,db: boolean;
|
||||||
begin
|
begin
|
||||||
np:= Pen.style <> psClear; // Need pen ?
|
np:= Pen.style <> psClear; // Need pen ?
|
||||||
nb:= Brush.style <> bsClear; // Need brush ?
|
nb:= Brush.style <> bsClear; // Need brush ?
|
||||||
@ -802,7 +803,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCustomCanvas.StretchDraw(x, y, w, h: integer; source: TFPCustomImage);
|
procedure TFPCustomCanvas.StretchDraw(x, y, w, h: integer; source: TFPCustomImage);
|
||||||
var i : TFPCustomInterpolation;
|
var
|
||||||
FreeInterpolation : boolean;
|
FreeInterpolation : boolean;
|
||||||
IP : TFPCustomInterpolation;
|
IP : TFPCustomInterpolation;
|
||||||
begin
|
begin
|
||||||
|
@ -139,7 +139,6 @@ var
|
|||||||
yEntry: Pointer;
|
yEntry: Pointer;
|
||||||
SrcStartY: LongInt;
|
SrcStartY: LongInt;
|
||||||
LastSrcStartY: LongInt;
|
LastSrcStartY: LongInt;
|
||||||
LastyEntry: Pointer;
|
|
||||||
sy: Integer;
|
sy: Integer;
|
||||||
xEntry: Pointer;
|
xEntry: Pointer;
|
||||||
sx: LongInt;
|
sx: LongInt;
|
||||||
@ -162,7 +161,6 @@ begin
|
|||||||
// current y line
|
// current y line
|
||||||
GetMem(HorzResized,w*ySupport*SizeOf(TFPColor));
|
GetMem(HorzResized,w*ySupport*SizeOf(TFPColor));
|
||||||
|
|
||||||
LastyEntry:=nil;
|
|
||||||
SrcStartY:=0;
|
SrcStartY:=0;
|
||||||
for dy:=0 to h-1 do
|
for dy:=0 to h-1 do
|
||||||
begin
|
begin
|
||||||
@ -173,7 +171,6 @@ begin
|
|||||||
NewSupportLines:=ySupport;
|
NewSupportLines:=ySupport;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
LastyEntry:=yEntry;
|
|
||||||
LastSrcStartY:=SrcStartY;
|
LastSrcStartY:=SrcStartY;
|
||||||
inc(yEntry,yEntrySize);
|
inc(yEntry,yEntrySize);
|
||||||
SrcStartY:=PInteger(yEntry)^;
|
SrcStartY:=PInteger(yEntry)^;
|
||||||
|
@ -414,6 +414,7 @@ var i, j, k, couples, singles, lastsingle : integer;
|
|||||||
nibline : pbyte; { temporary array of nibbles }
|
nibline : pbyte; { temporary array of nibbles }
|
||||||
even : boolean;
|
even : boolean;
|
||||||
begin
|
begin
|
||||||
|
even:=false;
|
||||||
getmem(nibline,width);
|
getmem(nibline,width);
|
||||||
try
|
try
|
||||||
k:=(Width div 2) + (Width mod 2);
|
k:=(Width div 2) + (Width mod 2);
|
||||||
|
@ -60,7 +60,7 @@ procedure FillFloodImageRel (Canv:TFPCustomCanvas; x,y :integer; const Image:TFP
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses clipping, ellipses;
|
uses clipping;
|
||||||
|
|
||||||
procedure FillRectangleColor (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer);
|
procedure FillRectangleColor (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer);
|
||||||
begin
|
begin
|
||||||
@ -587,7 +587,7 @@ type
|
|||||||
DoneList : TList;
|
DoneList : TList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindDoneIndex (const data:PFloodFillData; x:integer; var index:integer):boolean;
|
function FindDoneIndex (const data:PFloodFillData; x:integer; out index:integer):boolean;
|
||||||
begin
|
begin
|
||||||
with data^.DoneList do
|
with data^.DoneList do
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user