mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 09:21:10 +02:00
LCL/Graphics: Fix win32 WS not drawing incomplete continuous Bezier segments in PolyBezier. Do not copy points in overloaded procedure.
This commit is contained in:
parent
2c3a903d59
commit
9509e5aa8c
@ -840,19 +840,11 @@ end;
|
|||||||
procedure TCanvas.PolyBezier(const Points: array of TPoint;
|
procedure TCanvas.PolyBezier(const Points: array of TPoint;
|
||||||
Filled: boolean = False;
|
Filled: boolean = False;
|
||||||
Continuous: boolean = True);
|
Continuous: boolean = True);
|
||||||
var NPoints, i: integer;
|
var NPoints: integer;
|
||||||
PointArray: ^TPoint;
|
|
||||||
begin
|
begin
|
||||||
NPoints:=High(Points)-Low(Points)+1;
|
NPoints:=High(Points)-Low(Points)+1;
|
||||||
if NPoints<4 then exit; // Curve must have at least 4 points
|
if NPoints<4 then exit; // Curve must have at least 4 points
|
||||||
GetMem(PointArray,SizeOf(TPoint)*NPoints);
|
PolyBezier(@Points[0], NPoints, Filled, Continuous);
|
||||||
try
|
|
||||||
for i:=0 to NPoints-1 do
|
|
||||||
PointArray[i]:=Points[i+Low(Points)];
|
|
||||||
PolyBezier(PointArray, NPoints, Filled, Continuous);
|
|
||||||
finally
|
|
||||||
FreeMem(PointArray);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvas.PolyBezier(Points: PPoint; NumPts: Integer;
|
procedure TCanvas.PolyBezier(Points: PPoint; NumPts: Integer;
|
||||||
|
@ -2852,7 +2852,12 @@ begin
|
|||||||
If Filled or (not Continuous) then
|
If Filled or (not Continuous) then
|
||||||
Result := Inherited PolyBezier(DC,Points,NumPts, Filled, Continuous)
|
Result := Inherited PolyBezier(DC,Points,NumPts, Filled, Continuous)
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
|
// Make sure that only complete bezier segments are included in this mode.
|
||||||
|
// Otherwise, Windows will not draw anything at all.
|
||||||
|
NumPts := (NumPts - 1) div 3 * 3 + 1;
|
||||||
Result := Boolean(Windows.PolyBezier(DC, LPPOINT(Points)^, NumPts));
|
Result := Boolean(Windows.PolyBezier(DC, LPPOINT(Points)^, NumPts));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user