mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:29:23 +02:00
* optimization by Ondrej Pokorny, add const in front of TFPColor arguments where possible (bug ID 35131)
git-svn-id: trunk@41550 -
This commit is contained in:
parent
158224a808
commit
5ce75e42df
@ -19,11 +19,11 @@ interface
|
|||||||
|
|
||||||
uses classes, FPImage, FPCanvas;
|
uses classes, FPImage, FPCanvas;
|
||||||
|
|
||||||
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; c:TFPColor);
|
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; const c:TFPColor);
|
||||||
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Width:integer; c:TFPColor);
|
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Width:integer; const c:TFPColor);
|
||||||
procedure DrawPatternEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TPenPattern; c:TFPColor);
|
procedure DrawPatternEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TPenPattern; const c:TFPColor);
|
||||||
procedure FillEllipseColor (Canv:TFPCustomCanvas; const Bounds:TRect; c:TFPColor);
|
procedure FillEllipseColor (Canv:TFPCustomCanvas; const Bounds:TRect; const c:TFPColor);
|
||||||
procedure FillEllipsePattern (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TBrushPattern; c:TFPColor);
|
procedure FillEllipsePattern (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TBrushPattern; const c:TFPColor);
|
||||||
procedure FillEllipseHashHorizontal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashHorizontal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
procedure FillEllipseHashVertical (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashVertical (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
procedure FillEllipseHashDiagonal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
procedure FillEllipseHashDiagonal (Canv:TFPCustomCanvas; const Bounds:TRect; width:integer; const c:TFPColor);
|
||||||
@ -317,7 +317,7 @@ end;
|
|||||||
{ The drawing routines }
|
{ The drawing routines }
|
||||||
|
|
||||||
type
|
type
|
||||||
TPutPixelProc = procedure (Canv:TFPCustomCanvas; x,y:integer; color:TFPColor);
|
TPutPixelProc = procedure (Canv:TFPCustomCanvas; x,y:integer; const color:TFPColor);
|
||||||
TLinePoints = array[0..PatternBitCount-1] of boolean;
|
TLinePoints = array[0..PatternBitCount-1] of boolean;
|
||||||
PLinePoints = ^TLinePoints;
|
PLinePoints = ^TLinePoints;
|
||||||
|
|
||||||
@ -334,31 +334,31 @@ begin
|
|||||||
LinePoints^[0] := (APattern and i) <> 0;
|
LinePoints^[0] := (APattern and i) <> 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PutPixelCopy(Canv:TFPCustomCanvas; x,y:integer; color:TFPColor);
|
procedure PutPixelCopy(Canv:TFPCustomCanvas; x,y:integer; const color:TFPColor);
|
||||||
begin
|
begin
|
||||||
with Canv do
|
with Canv do
|
||||||
DrawPixel(x,y,color);
|
DrawPixel(x,y,color);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PutPixelXor(Canv:TFPCustomCanvas; x,y:integer; color:TFPColor);
|
procedure PutPixelXor(Canv:TFPCustomCanvas; x,y:integer; const color:TFPColor);
|
||||||
begin
|
begin
|
||||||
with Canv do
|
with Canv do
|
||||||
Colors[x,y] := Colors[x,y] xor color;
|
Colors[x,y] := Colors[x,y] xor color;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PutPixelOr(Canv:TFPCustomCanvas; x,y:integer; color:TFPColor);
|
procedure PutPixelOr(Canv:TFPCustomCanvas; x,y:integer; const color:TFPColor);
|
||||||
begin
|
begin
|
||||||
with Canv do
|
with Canv do
|
||||||
Colors[x,y] := Colors[x,y] or color;
|
Colors[x,y] := Colors[x,y] or color;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PutPixelAnd(Canv:TFPCustomCanvas; x,y:integer; color:TFPColor);
|
procedure PutPixelAnd(Canv:TFPCustomCanvas; x,y:integer; const color:TFPColor);
|
||||||
begin
|
begin
|
||||||
with Canv do
|
with Canv do
|
||||||
Colors[x,y] := Colors[x,y] and color;
|
Colors[x,y] := Colors[x,y] and color;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; c:TFPColor);
|
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
MyPutPix : TPutPixelProc;
|
MyPutPix : TPutPixelProc;
|
||||||
@ -387,7 +387,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Width:integer; c:TFPColor);
|
procedure DrawSolidEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Width:integer; const c:TFPColor);
|
||||||
var infoOut, infoIn : TEllipseInfo;
|
var infoOut, infoIn : TEllipseInfo;
|
||||||
r, y : integer;
|
r, y : integer;
|
||||||
id : PEllipseInfoData;
|
id : PEllipseInfoData;
|
||||||
@ -430,7 +430,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawPatternEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TPenPattern; c:TFPColor);
|
procedure DrawPatternEllipse (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TPenPattern; const c:TFPColor);
|
||||||
var info : TEllipseInfo;
|
var info : TEllipseInfo;
|
||||||
xx, y : integer;
|
xx, y : integer;
|
||||||
LinePoints : TLinePoints;
|
LinePoints : TLinePoints;
|
||||||
@ -496,7 +496,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FillEllipseColor (Canv:TFPCustomCanvas; const Bounds:TRect; 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;
|
id : PEllipseInfoData;
|
||||||
@ -514,7 +514,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FillEllipsePattern (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TBrushPattern; c:TFPColor);
|
procedure FillEllipsePattern (Canv:TFPCustomCanvas; const Bounds:TRect; Pattern:TBrushPattern; const c:TFPColor);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
function AlphaBlend(color1, color2: TFPColor): TFPColor;
|
function AlphaBlend(const color1, color2: TFPColor): TFPColor;
|
||||||
var
|
var
|
||||||
factor1, factor2: single;
|
factor1, factor2: single;
|
||||||
begin
|
begin
|
||||||
|
@ -286,7 +286,7 @@ function ConvertColor (const From : TFPColor; Fmt : TColorFormat) : TDeviceColor
|
|||||||
function ConvertColor (const From : TDeviceColor; Fmt : TColorFormat) : TDeviceColor;
|
function ConvertColor (const From : TDeviceColor; Fmt : TColorFormat) : TDeviceColor;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
function AlphaBlend(color1, color2: TFPColor): TFPColor;
|
function AlphaBlend(const color1, color2: TFPColor): TFPColor;
|
||||||
|
|
||||||
function FPColor (r,g,b,a:word) : TFPColor;
|
function FPColor (r,g,b,a:word) : TFPColor;
|
||||||
function FPColor (r,g,b:word) : TFPColor;
|
function FPColor (r,g,b:word) : TFPColor;
|
||||||
@ -561,7 +561,7 @@ FuzzyDepth: word = 4): TFPCustomImage;
|
|||||||
{ HTML Color support. RRGGBB or color name. Only W3 color names s are supported}
|
{ HTML Color support. RRGGBB or color name. Only W3 color names s are supported}
|
||||||
|
|
||||||
function TryHtmlToFPColor(const S: String; out FPColor: TFPColor): Boolean;
|
function TryHtmlToFPColor(const S: String; out FPColor: TFPColor): Boolean;
|
||||||
function HtmlToFPColorDef(const S: String; out FPColor: TFpColor; Def: TFPColor): TFPColor;
|
function HtmlToFPColorDef(const S: String; out FPColor: TFpColor; const Def: TFPColor): TFPColor;
|
||||||
function HtmlToFPColor(const S: String): TFPColor;
|
function HtmlToFPColor(const S: String): TFPColor;
|
||||||
|
|
||||||
|
|
||||||
@ -613,12 +613,12 @@ begin
|
|||||||
(c.Alpha = d.Alpha);
|
(c.Alpha = d.Alpha);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetFullColorData (color:TFPColor) : TColorData;
|
function GetFullColorData (const color:TFPColor) : TColorData;
|
||||||
begin
|
begin
|
||||||
result := PColorData(@color)^;
|
result := PColorData(@color)^;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SetFullColorData (color:TColorData) : TFPColor;
|
function SetFullColorData (const color:TColorData) : TFPColor;
|
||||||
begin
|
begin
|
||||||
result := PFPColor (@color)^;
|
result := PFPColor (@color)^;
|
||||||
end;
|
end;
|
||||||
@ -760,7 +760,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function HtmlToFPColorDef(const S: String; out FPColor: TFpColor; Def: TFPColor): TFPColor;
|
function HtmlToFPColorDef(const S: String; out FPColor: TFpColor; const Def: TFPColor): TFPColor;
|
||||||
begin
|
begin
|
||||||
if not TryHtmlToFPColor(S, Result) then
|
if not TryHtmlToFPColor(S, Result) then
|
||||||
Result := Def;
|
Result := Def;
|
||||||
|
@ -28,7 +28,7 @@ type
|
|||||||
FColorShift : word;
|
FColorShift : word;
|
||||||
FColorSize : byte;
|
FColorSize : byte;
|
||||||
procedure SetColorSize (AValue : byte);
|
procedure SetColorSize (AValue : byte);
|
||||||
function ColorToHex (c:TFPColor) : string;
|
function ColorToHex (const c:TFPColor) : string;
|
||||||
protected
|
protected
|
||||||
procedure InternalWrite (Str:TStream; Img:TFPCustomImage); override;
|
procedure InternalWrite (Str:TStream; Img:TFPCustomImage); override;
|
||||||
public
|
public
|
||||||
@ -61,7 +61,7 @@ begin
|
|||||||
FColorSize := AValue;
|
FColorSize := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPWriterXPM.ColorToHex (c:TFPColor) : string;
|
function TFPWriterXPM.ColorToHex (const c:TFPColor) : string;
|
||||||
var r,g,b : word;
|
var r,g,b : word;
|
||||||
begin
|
begin
|
||||||
with c do
|
with c do
|
||||||
|
@ -349,7 +349,7 @@ const
|
|||||||
|
|
||||||
procedure TFreeTypeFont.DrawChar (x,y:integer; data:PByteArray; pitch, width, height:integer);
|
procedure TFreeTypeFont.DrawChar (x,y:integer; data:PByteArray; pitch, width, height:integer);
|
||||||
|
|
||||||
procedure Combine (canv:TFPCustomCanvas; x,y:integer; c : TFPColor; t:longword);
|
procedure Combine (canv:TFPCustomCanvas; x,y:integer; const c : TFPColor; t:longword);
|
||||||
var
|
var
|
||||||
pixelcolor: TFPColor;
|
pixelcolor: TFPColor;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user