mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-10 03:18:22 +02:00
parent
20cab5a990
commit
e64f3abce1
@ -1168,23 +1168,32 @@ end;
|
|||||||
the current position
|
the current position
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCarbonDeviceContext.LineTo(X, Y: Integer);
|
procedure TCarbonDeviceContext.LineTo(X, Y: Integer);
|
||||||
|
var
|
||||||
|
deltaX, deltaY, absDeltaX, absDeltaY, clipDeltaX, clipDeltaY: Float32;
|
||||||
begin
|
begin
|
||||||
if CurrentPen.Width = 1 then
|
deltaX := X - PenPos.x;
|
||||||
|
deltaY := Y - PenPos.y;
|
||||||
|
absDeltaX := Abs(deltaX);
|
||||||
|
absDeltaY := Abs(deltaY);
|
||||||
|
// exclude the end-point from the rasterization
|
||||||
|
if (absDeltaX > 1.0) or (absDeltaY > 1.0) then
|
||||||
begin
|
begin
|
||||||
CGContextSaveGState(CGContext);
|
if absDeltaX > absDeltaY then
|
||||||
ExcludeClipRect(X, Y, X + 1, Y + 1);
|
begin
|
||||||
end;
|
if deltaX > 0 then clipDeltaX := -1.0 else clipDeltaX := 1.0;
|
||||||
|
clipDeltaY := clipDeltaX * deltaY / deltaX;
|
||||||
try
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if deltaY > 0 then clipDeltaY := -1.0 else clipDeltaY := 1.0;
|
||||||
|
clipDeltaX := clipDeltaY * deltaX / deltaY;
|
||||||
|
end;
|
||||||
CGContextBeginPath(CGContext);
|
CGContextBeginPath(CGContext);
|
||||||
// add 0.5 to both coordinates for better rasterization
|
// add 0.5 to both coordinates for better rasterization
|
||||||
CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5);
|
CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5);
|
||||||
CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5);
|
CGContextAddLineToPoint(CGContext, X + clipDeltaX + 0.5, Y + clipDeltaY + 0.5);
|
||||||
CGContextStrokePath(CGContext);
|
CGContextStrokePath(CGContext);
|
||||||
finally
|
|
||||||
if CurrentPen.Width = 1 then CGContextRestoreGState(CGContext);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FPenPos.x := X;
|
FPenPos.x := X;
|
||||||
FPenPos.y := Y;
|
FPenPos.y := Y;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user