You've already forked lazarus-ccr
* Optimize the case where FNumberColors = 1
* Code reformatting git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1076 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -440,7 +440,6 @@ begin
|
||||
Rp := GetClientRect;
|
||||
{ Extract the begin RGB values }
|
||||
case FDirection of
|
||||
|
||||
fdLeftToRight, ftTopToBottom: begin
|
||||
{ Set the Red, Green and Blue colors }
|
||||
BeginRGBValue[0] := GetRValue (ColorToRGB (FBeginColor));
|
||||
@ -488,14 +487,19 @@ begin
|
||||
ColorBand.Left := 0;
|
||||
ColorBand.Right := Width;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
{ Perform the fill }
|
||||
if FNumberOfColors = 1 then
|
||||
begin
|
||||
Canvas.Brush.Color := FBeginColor;
|
||||
Canvas.FillRect(rp);
|
||||
end
|
||||
else
|
||||
begin
|
||||
for I := 0 to FNumberOfColors do
|
||||
begin
|
||||
case FDirection of
|
||||
|
||||
{ Calculate the color band's left and right coordinates }
|
||||
fdLeftToRight, fdRightToLeft:
|
||||
begin
|
||||
@ -508,27 +512,16 @@ begin
|
||||
ColorBand.Bottom := MulDiv (I + 1, Height, FNumberOfColors);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Calculate the color band's color }
|
||||
if FNumberOfColors > 1 then
|
||||
begin
|
||||
R := BeginRGBValue[0] + MulDiv (I, RGBDifference[0], FNumberOfColors - 1);
|
||||
G := BeginRGBValue[1] + MulDiv (I, RGBDifference[1], FNumberOfColors - 1);
|
||||
B := BeginRGBValue[2] + MulDiv (I, RGBDifference[2], FNumberOfColors - 1);
|
||||
end
|
||||
else
|
||||
{ Set to the Begin Color if set to only one color }
|
||||
begin
|
||||
R := BeginRGBValue[0];
|
||||
G := BeginRGBValue[1];
|
||||
B := BeginRGBValue[2];
|
||||
end;
|
||||
|
||||
{ Select the brush and paint the color band }
|
||||
Canvas.Brush.Color := RGB (R, G, B);
|
||||
Canvas.FillRect (ColorBand);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Copy the working bitmap to the main canvas }
|
||||
Canvas.Draw(0, 0, WorkBmp);
|
||||
|
Reference in New Issue
Block a user