mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 19:35:58 +02:00
LCL Carbon: exclude last pixel when rasterizating line
git-svn-id: trunk@14445 -
This commit is contained in:
parent
8aedb53f6c
commit
8dde11e9ab
@ -1042,11 +1042,21 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCarbonDeviceContext.LineTo(X, Y: Integer);
|
procedure TCarbonDeviceContext.LineTo(X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
CGContextBeginPath(CGContext);
|
if CurrentPen.Width = 1 then
|
||||||
// add 0.5 to both coordinates for better rasterization
|
begin
|
||||||
CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5);
|
CGContextSaveGState(CGContext);
|
||||||
CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5);
|
ExcludeClipRect(X, Y, X + 1, Y + 1);
|
||||||
CGContextStrokePath(CGContext);
|
end;
|
||||||
|
|
||||||
|
try
|
||||||
|
CGContextBeginPath(CGContext);
|
||||||
|
// add 0.5 to both coordinates for better rasterization
|
||||||
|
CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5);
|
||||||
|
CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5);
|
||||||
|
CGContextStrokePath(CGContext);
|
||||||
|
finally
|
||||||
|
if CurrentPen.Width = 1 then CGContextRestoreGState(CGContext);
|
||||||
|
end;
|
||||||
|
|
||||||
FPenPos.x := X;
|
FPenPos.x := X;
|
||||||
FPenPos.y := Y;
|
FPenPos.y := Y;
|
||||||
|
@ -198,6 +198,9 @@ type
|
|||||||
constructor Create(AGlobal: Boolean); // create default pen
|
constructor Create(AGlobal: Boolean); // create default pen
|
||||||
constructor Create(ALogPen: TLogPen);
|
constructor Create(ALogPen: TLogPen);
|
||||||
procedure Apply(ADC: TCarbonContext; UseROP2: Boolean = True);
|
procedure Apply(ADC: TCarbonContext; UseROP2: Boolean = True);
|
||||||
|
|
||||||
|
property Width: Integer read FWidth;
|
||||||
|
property Style: LongWord read FStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCarbonBitmap }
|
{ TCarbonBitmap }
|
||||||
|
Loading…
Reference in New Issue
Block a user