lcl: remove unneeded checks in rectangle gradient

git-svn-id: trunk@38772 -
This commit is contained in:
paul 2012-09-21 06:06:10 +00:00
parent dd5f4ac615
commit f11822757d

View File

@ -1418,7 +1418,7 @@ function TWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices: Lon
StartColor, EndColor, CurColor: TFPColor; StartColor, EndColor, CurColor: TFPColor;
I, J: Longint; I, J: Longint;
SwapColors: Boolean; SwapColors: Boolean;
Steps, MaxSteps: Integer; Steps: Integer;
Image: TLazIntfImage; Image: TLazIntfImage;
R: TRect; R: TRect;
begin begin
@ -1450,14 +1450,6 @@ function TWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices: Lon
StartColor := EndColor; StartColor := EndColor;
EndColor := CurColor; EndColor := CurColor;
end; end;
MaxSteps := GetDeviceCaps(DC, BITSPIXEL);
if MaxSteps >= 32 then
MaxSteps := High(Integer)
else
if MaxSteps >= 4 then
MaxSteps := 1 shl MaxSteps
else
MaxSteps := 256;
R := Rect(TL.X, TL.Y, BR.X, BR.Y); R := Rect(TL.X, TL.Y, BR.X, BR.Y);
dec(BR.X, TL.X); dec(BR.X, TL.X);
@ -1468,7 +1460,7 @@ function TWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices: Lon
if DoFillVRect then if DoFillVRect then
begin begin
Steps := Min(BR.Y, MaxSteps); Steps := BR.Y;
for I := 0 to Steps - 1 do for I := 0 to Steps - 1 do
begin begin
CurColor := GetRectangleGradientColor(StartColor, EndColor, I, Steps); CurColor := GetRectangleGradientColor(StartColor, EndColor, I, Steps);
@ -1478,7 +1470,7 @@ function TWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices: Lon
end end
else else
begin begin
Steps := Min(BR.X, MaxSteps); Steps := BR.X;
for I := 0 to Steps - 1 do for I := 0 to Steps - 1 do
begin begin
CurColor := GetRectangleGradientColor(StartColor, EndColor, I, Steps); CurColor := GetRectangleGradientColor(StartColor, EndColor, I, Steps);